erb is vulnerable to Deserialization of Untrusted Data
81
High Risk
ERB guards ERB#result and ERB#def_method against execution on marshal-loaded instances by checking whether the @_init instance variable is the class singleton. The guard calls equal? directly on @_init, a value an attacker fully controls when an ERB object is reconstructed through Marshal.load. An attacker-supplied @_init object that overrides equal? to return true defeats the check, letting the template source in @src reach eval and execute arbitrary code. The fix performs the identity comparison through BasicObject#equal? bound via UnboundMethod#bind_call, so an overridden equal? can no longer bypass the guard.
You are affected if you are using a version that falls within the vulnerable range and your application calls Marshal.load on untrusted data while the erb library is loaded.
erb is vulnerable to Deserialization of Untrusted Data in versions 2.2.0 - 6.0.4.
Upgrade the erb library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant