Research / Article

Hidden Exploitable Behaviors in Programming Languages

Uncover the security flaws associated with hacking programming languages, particularly the vulnerabilities in Ruby's open() function.

Black Hat EuropeEgor Homakovfernando arnaboldihackinfosec

Consider the following Ruby script named open-uri.rb:

And the following output is shown:

Works as expected, right? Still, this command may be used to open a process that allows any command to be executed. If a similar Ruby script is used in a web application with weak input validation then you could just add a pipe and your favorite OS command in a remote request:

And the following output could be shown:

The difference between the two executions is just the pipe character at the beginning. The pipe character causes Ruby to stop using the function from open-uri, and use the native open() functionality that allows command execution[2].

Want the research before the news cycle?

Get in touch