Missing resource identifier encoding may lead to security vulnerabilities
ActiveResource methods such as find and exists? do not URL-encode the resource identifier, so a crafted identifier can inject query parameters into the request path. An attacker could use this to add filter parameters to an index endpoint and infer information from response timing.
- Triaged in 41 hours
- Fixed in 2 months
- Disclosed after 3 months
(I initially submitted this to the GitHub repository because the ActiveResource repository is not listed in scope. I was redirected here by @rafaelfranca)
A number of methods in the ActiveResource library, such as ActiveResource::Base#find and ActiveResource::Base#exists? don't URL encode the resource identifier that is passed to them. Consider the following code:
require 'activeresource'
class Test < ActiveResource::Base
self.site = 'http://127.0.0.1:8080'
end
Test.exists? '?a=1'
The code above is expected to make a request to http://127.0.0.1:8080/tests/%3fa%3d1.json by properly URL encoding the resource identifier. Instead, it makes a request to http://127.0.0.1:8080/tests/?a=1.json.
This was tested against ActiveResource 5.1.0 and 5.0.0, both have the same unexpected behavior.
Impact
Because the index /tests/ returns an array of objects, the code will throw an exception. However, due to the time difference that could be observed, an attacker could potentially exploit this by injecting a filter parameter to index endpoint of the resource. E.g.
| Resource identifier | Objects returned | RTT |
|---|---|---|
?type=a& |
1 | 500ms |
?type=b& |
0 | 100ms |
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could potentially inject filter parameters into an index endpoint and infer information from response timing, though the index response itself causes an exception.
What the attacker needed
Application passes untrusted input as resource identifier
How it was found
- Define a model class with a site URL.
- Call exists? with a resource identifier containing a question mark and parameters.
- Observe the request goes to the index path with the parameters appended instead of an encoded identifier.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program builds a web address from user input, it must encode special characters so they cannot change the address's meaning. Here, a library skipped that encoding, letting an attacker slip extra query parameters into the request. The report shows this could let someone filter results and guess data from how long responses take.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.