Looking for the vulnerability index of Invicti's legacy products?
Stack Trace Disclosure (Ruby-Sinatra Framework) - Vulnerability Database

Stack Trace Disclosure (Ruby-Sinatra Framework)

Description

The application exposes detailed stack traces when errors occur, revealing internal implementation details about the Ruby-Sinatra framework environment. Stack traces typically contain sensitive technical information including file system paths, code snippets, framework version numbers, database connection details, and internal application structure. This information disclosure occurs when exceptions are not properly handled and error details are displayed directly to end users.

Remediation

Configure the application to handle exceptions gracefully without exposing technical details to users. In production environments, disable detailed error reporting and implement custom error pages that display generic messages.

For Ruby-Sinatra applications, implement the following measures:

1. Disable the default error handler in production by setting:

configure :production do
  set :show_exceptions, false
  set :dump_errors, false
end

2. Implement a custom error handler that logs detailed errors server-side while showing generic messages to users:
error do
  # Log the full error details for debugging
  logger.error "Error: #{env['sinatra.error']}"
  logger.error env['sinatra.error'].backtrace.join("\n")
  
  # Return a generic error page to the user
  status 500
  'An unexpected error occurred. Please try again later.'
end

3. Ensure all error logging is directed to secure log files with appropriate access controls, not to user-facing output.
4. Regularly review error logs to identify and fix recurring issues.

Related Vulnerabilities