GHSA-p4c6-77gc-694x CVE-2007-6077
session fixation protection mechanism in cgi_process.rb in Rails
- Severity
- Medium
- The publisher's own rating, not a CVSS score
- Exploit chance (EPSS)
- 2.51%
- Chance of exploitation in the next 30 days. Higher than 84.79% 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
1.2.6- Upgrade rails to this version or later
Description
The session fixation protection mechanism in cgi_process.rb in Rails 1.2.4, as used in Ruby on Rails, removes the :cookie_only attribute from the DEFAULT_SESSION_OPTIONS constant, which effectively causes cookie_only to be applied only to the first instantiation of CgiRequest, which allows remote attackers to conduct session fixation attacks. NOTE: this is due to an incomplete fix for CVE-2007-5380.
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| rails | < 1.2.6 |
1.2.6 |
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.
rails RubyGems → 1.2.6
- bundler
bundle update rails # Gemfile: gem "rails", ">= 1.2.6"
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
- github.com/rubysec/ruby-advisory-db/blob/master/gems/rails/CVE-2007-6077.yml
- rubyonrails.org/2007/11/24/ruby-on-rails-1-2-6-security-and-maintenance-release
- dev.rubyonrails.org/changeset/8177
- dev.rubyonrails.org/ticket/10048
- docs.info.apple.com/article.html
- lists.apple.com/archives/security-announce/2007/Dec/msg00002.html
- secunia.com/advisories/27781
- secunia.com/advisories/28136
- weblog.rubyonrails.org/2007/11/24/ruby-on-rails-1-2-6-security-and-maintenance-release
- securityfocus.com/bid/26598
- us-cert.gov/cas/techalerts/TA07-352A.html
- vupen.com/english/advisories/2007/4009
- vupen.com/english/advisories/2007/4238
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-9822-6m93-xqf4 Rails has possible XSS Vulnerability in Action Controller | Medium | Also affects rails |
| GHSA-rxq3-gm4p-5fj4 rails vulnerable to improper authentication | Critical | Also affects rails |
| GHSA-rvpq-5xqx-pfpp Ruby on Rails vulnerable to code injection | High | Also affects rails |
| GHSA-jmgf-p46x-982h rails is vulnerable to CRLF injection | Medium | Also affects rails |
| GHSA-jwhv-rgqc-fqj5 Session fixation vulnerability in Rails | Medium | Also affects rails |
| GHSA-fjfg-q662-gm6j Moderate severity vulnerability that affects rails | Medium | Also affects rails |
| GHSA-gm25-fpmr-43fj Moderate severity vulnerability that affects rails | Medium | Also affects rails |
| GHSA-9wrq-xvmp-xjc8 Rails Denial of Service vulnerability | High | Also affects rails |
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