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
- 1Wrap the request-handling code in a rescue block that logs the backtrace and returns a generic error response.
- 2For Sinatra, disable :raise_errors and :show_exceptions in production ('set :environment, :production').
- 3Run the app with RACK_ENV=production so framework-level error pages are generic.
Code examples
Sinatra production settings
configure :production do
set :raise_errors, false
set :show_exceptions, false
endReferences
Detected automatically by VulnRadar. The check id is ruby-backtrace-exposed, stable across every scan so you can filter or diff on it.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoconfig.js / settings.js referenced (verify contents)
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
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.