Skip to content
Misconfiguration Disclosed report Intermediate

Incorrect detection of onion URLs

The library's checks for whether a URL points to a Tor .onion address used loose regular expressions and a substring search, so ordinary domains could be mistaken for onion services. This meant HTTPS was not forced and plain HTTP was allowed for non-onion URLs, leaving those connections open to interception.

e3amn2l Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 3 days
  • Paid in 6 months
  • Disclosed after 3 days

Several places have incorrect code to detect if URL point to .onion domain (tor hidden server):

The following regexes:

1. #^https://([^/:]+)\.onion:(?:([0-9]+))#
2. #^https?://([^/]+)\.onion#

which is used in: https://github.com/paragonie/airship/blob/0e9289553cdc538556d362faaee63be6cc534a0c/src/Engine/Hail.php#L223 https://github.com/paragonie/airship/blob/0e9289553cdc538556d362faaee63be6cc534a0c/src/Engine/Hail.php#L231

will pass for the following URLs which have example.com as domain and are valid for curl in php (was tested via curl_setopt($ch, CURLOPT_URL, $url))

1 => https://example.com?.onion:443
1 => https://example.com&.onion:443
2 => http://example.com?.onion
2 -> http://example.com&.onion

which is problematic because:

  1. The code in: will not force HTTPS if url passed the above regex. (thus incorrect check = HTTPS not forced for not .onion domain)

https://github.com/paragonie/airship/blob/0e9289553cdc538556d362faaee63be6cc534a0c/src/Engine/Hail.php#L228-L229

                // Don't force HTTPS
                unset($defaults['curl'][CURLOPT_SSLVERSION]);
  1. the second regex allow http url (thus incorrect check = HTTP for not .onion domain is vulnerable to MITM)
  2. potential of code reuse by people who read the code and assume it's safe.

The following code just search for .onion in $url, for example https://domain.onionweb.com/ will pass the check but isn't .onion website.

in: https://github.com/paragonie/airship/blob/58f96aa0e5002b60e74456502d9bfc9483d77b3d/src/Engine/Keyggdrasil/Peer.php#L50 https://github.com/paragonie/airship/blob/0e9289553cdc538556d362faaee63be6cc534a0c/src/Engine/Continuum/Channel.php#L154 https://github.com/paragonie/airship/blob/0e9289553cdc538556d362faaee63be6cc534a0c/src/Engine/Continuum/Channel.php#L239 https://github.com/paragonie/airship/blob/90a8317107ecfdf38be57f36e4a1a81e69280f24/src/Cabin/Bridge/Blueprint/ChannelUpdates.php#L117 https://github.com/paragonie/airship/blob/58f96aa0e5002b60e74456502d9bfc9483d77b3d/src/Engine/Keyggdrasil/Peer.php#L82

            if (\strpos($url, '.onion') !== false) {

fix: 1. implement and use across the codebase function such as isUrlOnion($url) which return true if url point to onion domain, and use secure implementation, for example: consider using something like:

		function isUrlOnion($url) {
			$host = parse_url($url, PHP_URL_HOST);
			if($host != null) {
				return substr_compare($url, '.onion', -strlen('.onion')) === 0;
			}
			return false;
		}

The original report as published on HackerOne, by e3amn2l. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Root cause

The regexes matched '.onion' mid-URL rather than requiring the hostname to end with it.

Impact

Non-onion URLs could be misclassified, so HTTPS was not forced and plain HTTP was permitted, making those connections vulnerable to man-in-the-middle attacks.

The fix

The report recommends a shared helper that parses the URL's host and checks that it ends with '.onion'; the text does not say whether this was applied.

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.

A .onion address is a special web address that only works inside the Tor network. The code tried to spot these addresses with pattern matching that was too loose, so a normal website address could be wrongly treated as a Tor address. When that happened, the library skipped its usual safety step of forcing an encrypted HTTPS connection.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by e3amn2l

View all

8 more disclosed reports, best first.

More from Paragon Initiative Enterprises

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.