GHSA-jjcj-fgfm-9g9r CVE-2018-12029
Phusion Passenger Race Condition Allows Privilege Escalation
- Severity
- 7.0 / 10
- High · CVSS 3.0
- Exploit chance (EPSS)
- 0.27%
- Chance of exploitation in the next 30 days. Higher than 19.81% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
- Fix
5.3.2- Upgrade passenger to this version or later
Description
A race condition in the nginx module in Phusion Passenger 3.x through 5.x before 5.3.2 allows local escalation of privileges when a non-standard passenger_instance_registry_dir with insufficiently strict permissions is configured. Replacing a file with a symlink after the file was created, but before it was chowned, leads to the target of the link being chowned via the path. Targeting sensitive files such as root's crontab file allows privilege escalation.
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| passenger | >= 3.0.0, < 5.3.2 |
5.3.2 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
passenger RubyGems → 5.3.2
- bundler
bundle update passenger # Gemfile: gem "passenger", ">= 5.3.2"
Severity breakdown
CVSS 3.0 7.0
CVSS:3.0/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Local
- Attack complexity
- High
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Weakness
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.
How to prevent it
- Architecture and Design: In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.
- Architecture and Design: Use thread-safe capabilities such as the data access abstraction in Spring.
- Architecture and Design: Minimize the usage of shared resources in order to remove as much complexity as possible from the control flow and to reduce the likelihood of unexpected conditions occurring. Additionally, this will minimize the amount of synchronization necessary and may even help to reduce the likelihood of a denial of service where an attacker may be able to repeatedly trigger a critical section (CWE-400).
- Implementation: When using multithreading and operating on shared variables, only use thread-safe functions.
- Implementation: Use atomic operations on shared variables. Be wary of innocent-looking constructs such as "x++". This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write.
- Implementation: Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412.
- Implementation: Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization.
- Implementation: Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop.
- Implementation: Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help.
- Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
References
Advisories
Other links
- blog.phusion.nl/2018/06/12/passenger-5-3-2-various-security-fixes
- blog.phusion.nl/passenger-5-3-2
- github.com/rubysec/ruby-advisory-db/blob/master/gems/passenger/CVE-2018-12029.yml
- lists.debian.org/debian-lts-announce/2018/06/msg00007.html
- pulsesecurity.co.nz/advisories/phusion-passenger-priv-esc
- security.gentoo.org/glsa/201807-02
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-2cj2-qqxj-5m3r Phusion Passenger denial of service | High | Also affects passenger |
| GHSA-7cv3-gvmc-8mq5 Phusion Passenger SpawningKit Contains Arbitrary Read/Write Vulnerability | Critical | Also affects passenger |
| GHSA-4284-jfhc-f854 Phusion Passenger incorrect permission assignment | Medium | Also affects passenger |
| GHSA-whfx-877c-5p28 Insecure Permissions in Phusion Passenger | High | Also affects passenger |
| GHSA-jjhj-8gx7-x836 Incorrect Access Control in Phusion Passenger | High | Also affects passenger |
| GHSA-cv3f-px9r-54hm Phusion Passenger information disclosure | Medium | Also affects passenger |
| GHSA-8mw8-j583-vqfg RubyGems passenger gem allows remote attackers to delete files | High | Also affects passenger |
| GHSA-qw8w-2xcp-xg59 Insecure use of temporary files in Phusion passenger | Low | Also affects passenger |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor