GHSA-c6qr-h5vq-59jc CVE-2020-8185
Untrusted users can run pending migrations in production in Rails
- Severity
- 6.5 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 2.18%
- Chance of exploitation in the next 30 days. Higher than 82.36% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-400 Uncontrolled Resource Consumption
- Fix
6.0.3.2- Upgrade actionpack to this version or later
Description
There is a vulnerability in versions of Rails prior to 6.0.3.2 that allowed an untrusted user to run any pending migrations on a Rails app running in production.
This vulnerability has been assigned the CVE identifier CVE-2020-8185.
Versions Affected: 6.0.0 < rails < 6.0.3.2
Not affected: Applications with config.action_dispatch.show_exceptions = false (this is not a default setting in production)
Fixed Versions: rails >= 6.0.3.2
Impact
Using this issue, an attacker would be able to execute any migrations that are pending for a Rails app running in production mode. It is important to note that an attacker is limited to running migrations the application developer has already defined in their application and ones that have not already run.
Workarounds
Until such time as the patch can be applied, application developers should disable the ActionDispatch middleware in their production environment via a line such as this one in their config/environment/production.rb:
config.middleware.delete ActionDispatch::ActionableExceptions
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| actionpack | >= 6.0.0, < 6.0.3.2 |
6.0.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.
actionpack RubyGems → 6.0.3.2
- bundler
bundle update actionpack # Gemfile: gem "actionpack", ">= 6.0.3.2"
Severity breakdown
CVSS 3.1 6.5
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-400: Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource.
How to prevent it
- Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
- Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
- Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
- Implementation: Ensure that all failures in resource allocation place the system into a safe posture.
References
Advisories
Other links
- github.com/rails/rails/commit/2121b9d20b60ed503aa041ef7b926d331ed79fc2
- hackerone.com/reports/899069
- github.com/rubysec/ruby-advisory-db/blob/master/gems/actionpack/CVE-2020-8185.yml
- groups.google.com/g/rubyonrails-security/c/pAe9EV8gbM0
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XJ7NU…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-6x85-j5j2-27jx actionpack Path Traversal vulnerability | High Known exploited | Also affects actionpack |
| GHSA-xrr4-p6fq-hjg7 Directory traversal vulnerability in Action View in Ruby on Rails | High Known exploited | Also affects actionpack |
| GHSA-pgm4-439c-5jp6 Rails has a possible XSS vulnerability in its Action Pack debug exceptions | Medium | Also affects actionpack |
| GHSA-vfm5-rmrh-j26v Possible Content Security Policy bypass in Action Dispatch | Low | Also affects actionpack |
| GHSA-vfg9-r3fq-jvx4 Possible ReDoS vulnerability in HTTP Token authentication in Action Controller | Medium | Also affects actionpack |
| GHSA-x76w-6vjr-8xgj Possible ReDoS vulnerability in query parameter filtering in Action Dispatch | Medium | Also affects actionpack |
| GHSA-fwhr-88qx-h9g7 Missing security headers in Action Pack on non-HTML responses | Critical | Also affects actionpack |
| GHSA-9822-6m93-xqf4 Rails has possible XSS Vulnerability in Action Controller | Medium | Also affects actionpack |
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