Skip to main content
MediumInfo disclosureOWASP A05:2021CWE-209

How to fix: Ruby Exception Backtrace Exposed

A Ruby exception backtrace (two or more '<file>.rb:LINE:in `method'' frames) was found in the response body.

Why it matters

The backtrace discloses application file paths, method names, and gem versions in use, narrowing down the framework/library fingerprint for an attacker.

Plain Ruby scripts and lightweight frameworks (Sinatra, Rack apps) that don't run in a Rails-style production error-handling mode will render the raw exception and backtrace directly into the response when an unhandled exception occurs.

How to fix it

  1. 1Wrap the request-handling code in a rescue block that logs the backtrace and returns a generic error response.
  2. 2For Sinatra, disable :raise_errors and :show_exceptions in production ('set :environment, :production').
  3. 3Run the app with RACK_ENV=production so framework-level error pages are generic.

Code examples

Sinatra production settings

Ruby
configure :production do
  set :raise_errors, false
  set :show_exceptions, false
end

References

Detected automatically by VulnRadar. The check id is ruby-backtrace-exposed, stable across every scan so you can filter or diff on it.

See every info disclosure check

Questions

How severe is Ruby Exception Backtrace Exposed?
VulnRadar rates this medium severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id ruby-backtrace-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Ruby Exception Backtrace Exposed map to?
It maps to CWE-209. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for ruby exception backtrace exposed

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Ruby Exception Backtrace Exposed | VulnRadar