BooruprojectBridge: SSRF via unvalidated 'i' parameter, bypasses intended booru.org-only host restriction
Summary
BooruprojectBridge is designed to fetch content only from *.booru.org subdomains -- the UI explicitly labels its i parameter as "Booru subdomain (subdomain.booru.org)". However, the bridge builds the fetch URL by naive string concatenation of the raw, unvalidated i input into the host position, and RSS-Bridge's parameter validator applies no format restriction to this field (no type, no pattern). An attacker can supply a value containing a / character to break out of the intended subdomain position and redirect the bridge's server-side HTTP fetch to an arbitrary host of their choosing -- completely bypassing the bridge author's intended booru.org-only restriction.
This is not the generic "RSS-Bridge fetches arbitrary sites by design" risk (that applies to bridges that intentionally accept a full URL, e.g. XPathBridge, MoinMoinBridge); BooruprojectBridge explicitly does not intend to accept an arbitrary host, only a subdomain label, and that restriction is what's broken.
Affected Component
bridges/BooruprojectBridge.php (extends bridges/DanbooruBridge.php), current main branch.
Root Cause
// bridges/BooruprojectBridge.php
const PARAMETERS = [
'global' => [
'p' => [ 'name' => 'page', 'defaultValue' => 0, 'type' => 'number' ],
't' => [ 'name' => 'tags', 'required' => true, 'exampleValue' => 'tagme', ... ]
],
'Booru subdomain (subdomain.booru.org)' => [
'i' => [
'name' => 'Subdomain',
'required' => true,
'exampleValue' => 'rm'
// no 'type' -> defaults to 'text'
// no 'pattern' -> no format restriction at all
]
]
];
...
protected function getURI()
{
if (!is_null($this->getInput('i'))) {
return 'https://' . $this->getInput('i') . '.booru.org/'; // line 63
}
...
}// bridges/DanbooruBridge.php
protected function getFullURI()
{
return $this->getURI()
. 'posts?&page=' . $this->getInput('p')
. '&tags=' . urlencode($this->getInput('t'));
}
public function collectData()
{
$html = getSimpleHTMLDOMCached($this->getFullURI()); // fetches the URL server-side
...
}lib/ParameterValidator.php's validateTextValue() falls back to bare filter_var($value) (no filter constant = no-op passthrough) when no pattern is set for a text-type parameter -- confirmed via standalone PHP: filter_var("169.254.169.254/latest/meta-data/") returns the string unmodified.
Because i is concatenated directly before the fixed .booru.org/ suffix, a / in the attacker's input terminates the intended hostname early. Everything after that / (including the literal .booru.org/ suffix and the rest of the query string) becomes part of the path on the attacker-chosen host instead of the hostname.
Proof of Concept (isolated-algorithm-verified)
<?php
$value = "169.254.169.254/latest/meta-data/";
var_dump(filter_var($value));
// string(35) "169.254.169.254/latest/meta-data/" <- passed through unmodified
$uri = 'https://' . $value . '.booru.org/';
echo $uri . "\n";
// https://169.254.169.254/latest/meta-data/.booru.org/
$full = $uri . 'index.php?page=post&s=list&pid=0&tags=tagme';
echo $full . "\n";
// https://169.254.169.254/latest/meta-data/.booru.org/index.php?page=post&s=list&pid=0&tags=tagmeResulting live request against an RSS-Bridge instance:
GET /?action=display&format=Atom&bridge=Booruproject&t=tagme&i=169.254.169.254%2Flatest%2Fmeta-data%2Fcauses the server to issue a GET request to https://169.254.169.254/latest/meta-data/.booru.org/index.php?... -- i.e. to the AWS instance-metadata IP, or any other internal/attacker host of the requester's choosing, not to any *.booru.org host as the bridge's own parameter label promises.
Areas checked, confirmed clean (same shape, correctly guarded)
bridges/NewgroundsBridge.php-- same host-concatenation shape, butcollectData()runspreg_match('/^\w+$/', $username)before use, rejecting/. Not exploitable.GroupBundNaturschutzBridge.php,OnVaSortirBridge.php,NewOnNetflixBridge.php,WebfailBridge.php-- same shape, but all usetype: listparameters restricted server-side to a hardcodedvaluesarray. Not exploitable.
Possible sibling instance, not separately verified here
bridges/CraigslistBridge.php -- region is free-text feeding 'https://' . region . '.craigslist.org/search/', structurally identical. Worth checking with the same fix.
Impact
An RSS-Bridge operator who whitelists BooruprojectBridge -- believing (per the bridge's own UI label) that it can only reach *.booru.org -- can be made to issue arbitrary outbound HTTP requests to cloud metadata endpoints (credential theft on AWS/GCP/Azure-hosted instances), internal/private network services, or arbitrary external hosts as a proxy/redirector. Since RSS-Bridge caches and returns fetched content as a feed, response content may also be partially reflected back to the requester.
Suggested Fix
Add a pattern (e.g. 'pattern' => '[\w-]+') to the i parameter in BooruprojectBridge::PARAMETERS, mirroring the \w+ validation already used in NewgroundsBridge. More generally, any bridge parameter concatenated into a URL's authority/host component before validation should be restricted to ^[\w-]+$ at the parameter-definition level, since type: text performs no sanitization by default. Worth auditing all PARAMETERS entries used in host-position string concatenation (see CraigslistBridge.php noted above).
Source: RSS-Bridge/rss-bridge