Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1016605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:34:26+00:00 2026-05-16T10:34:26+00:00

Ruby’s safe mode disallows the use of tainted data by potentially dangerous operations. It

  • 0

Ruby’s safe mode disallows the use of tainted data by potentially dangerous operations. It varies in levels, 0 being disabled, and then 1-4 for levels of security. What vulnerabilities are possible when safe mode is enabled? Do you know of any CVE numbers issued to a ruby program when safe mode is enabled? What CWE Violations (or cwe families) are possible with safe mode enabled?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:34:27+00:00Added an answer on May 16, 2026 at 10:34 am

    All application-level vulnerabilities are completely unaffected by the $SAFE level. Injection attacks that don’t pass through an “unsafe operation” like cross-site scripting and SQL injection for example. This includes, more or less, every vulnerability class for web applications, except perhaps local and remote file inclusion. See the OWASP Top 10, $SAFE doesn’t help with many of these.

    The $SAFE level does protect you somewhat against system-level vulnerabilities though. If an attacker is able to write Ruby code into a file in /tmp, they wouldn’t then be able to trick your program into loading that code if $SAFE >= 2.

    And this of course doesn’t include any vulnerabilities with Ruby itself. These are much more serious, and can bypass $SAFE entirely.

    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3657
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3655
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-3694
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2337

    Or plain old buffer overflows, integer overflows, etc in the Ruby interpreter itself that have nothing to do with $SAFE.

    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2489
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-4124
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2726
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2376

    Rails has a history vulnerabilities that occur whether $SAFE is enabled or not. This is complicated by the fact that user input is stored in Rails applications, and malicious data can pop back up at a later time.

    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-4214
    • http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3009

    Vulnerability reports in Ruby applications other than Rails and MRI are hard to come by.

    Another big problem with $SAFE is there is no real list (that I know of) that outlines exactly what $SAFE does and doesn’t protect. About the only thing you can do is search for ruby_safe_level in eval.c (this is an older eval.c from 1.8.4). The comments provide this description, but it’s pretty vague.

    /* safe-level:
       0 - strings from streams/environment/ARGV are tainted (default)
       1 - no dangerous operation by tainted value
       2 - process/file operations prohibited
       3 - all generated objects are tainted
       4 - no global (non-tainted) variable modification/no direct output
    */
    

    I guess what I’m trying to say is that $SAFE is all about system security. It does an OK job, but there’s no real way to know exactly what is and is not protected. It shouldn’t be your only line of defense, it’s more of a safety net so nothing slips through to an “unsafe operation.” On the other hand, it has nothing to do with application security, and won’t save your data or users from being compromised. And on top of that, MRI has a history of vulnerabilities that bypass $SAFE entirely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ruby-mode from svn, looks equal to 1.1 version here is emacs indentation of hash
Ruby compacts the sequence only if it has nil value, how do I compact
Ruby on Rails: I'd like the <%= render 'shared/intro_form' %> to render a form
Ruby has a select method that takes an array and returns a subarray consisting
Ruby code is: a = [] h = {} 2.times.each do |i| %w(a b
Ruby doesn't seem to have a facility for defining a protected/private block like so:
Ruby's unit testing framework executes unit tests even though nobody creates unit test object.
Ruby tempfile instances automatically delete their corresponding file when the references are released. However,
Ruby on Rails has become a new competitive face in the server programming industry,
Ruby defines #clone in Object . To my suprise, some classes raise Exceptions when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.