Skip to content
DoS Disclosed report Intermediate CVE-2020-8185

Untrusted users able to run pending migrations in production

A vulnerability in Rails versions before [redacted] allowed an untrusted user to run any pending database migrations on a production app. An attacker could execute migrations that the developer had defined but not yet run.

tenderlove Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • Fixed in 9 days
  • Disclosed after 39 days

Untrusted users able to run pending migrations in production

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-XXXX.

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

Releases

The new release (6.0.3.2) is available in the regular locations.

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

Patches

As mentioned, we are releasing the following patch for the 6.0 release series:

  • 0001-6.0.3.1-Only-allow-ActionableErrors-if-show_detailed_excepti.patch

Credits

This issue was discovered independently by Rafael França and Benoit Côté-Jodoin. The patch above was provided by Rafael.

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 ran.

The original report as published on HackerOne, by tenderlove. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ActionDispatch middleware exposed a way to trigger pending migrations through error handling when detailed exceptions were shown.

Impact

An attacker could run any pending migrations that the developer had already defined but not yet executed, potentially altering the database.

What the attacker needed

Rails app in production; pending migrations exist; show_exceptions not disabled

The fix

The vulnerability was fixed in Rails 6.0.3.2; as a workaround, developers could remove the ActionDispatch::ActionableExceptions middleware from production.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In web applications, a migration is a script that changes the database structure, like adding a table. Normally only developers run these during deployment. This bug let anyone trigger pending migrations on a live site, which could alter the database unexpectedly.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by tenderlove

View all

2 more disclosed reports, best first.

More from Ruby on Rails

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.