Bad extended ascii handling in HTTP 301 redirects of t.co
The t.co URL shortener mishandled extended ASCII characters in HTTP 301 redirects, causing a different script to be downloaded than the one previewed in a browser. An attacker could use this to trick a user into running a malicious script.
Originally disclosed on HackerOne
- Triaged in 1 hour
- Fixed in 6 months
- Paid in 6 days
- Disclosed after 9 months
This proof of concept is conceived and tested on Linux+bash (because I'm an user), and of course is harmless.
Imagine a tweet or a line in a tutorial that look like this :
wget http://t.co/abP2XEsm82 -O cafe.sh && chmod +x cafe.sh && ./cafe.sh
Of course, you'll test the link in a browser to see if the script downloaded is harmless. It's the case. So you copy/paste the whole command in bash and execute it. And here is the issue, because the script previewed and the one downloaded are different.
All the details of the issue are in the script downloaded. I think the correction is easy enough (change the padding of the extended ascii char), but the possibilities of phishing with this bug are big.
Anyway, I'm available if you have any question, @Cqoicebordel or here.
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
Likely the redirect handling did not correctly encode or pad extended ASCII characters, so different clients interpreted the redirect target differently.
Impact
An attacker could use this discrepancy for phishing, tricking a user into running a malicious script after previewing a harmless one.
What the attacker needed
Victim uses a command-line tool like wget; victim previews link in a browser first; attacker controls a t.co short link
The fix
The report suggests the fix is to change the padding of the extended ASCII character, but does not state that it was fixed.
How it was found
- Create a tweet or tutorial line containing a wget command that downloads from a t.co short link and then executes the file.
- Open the t.co link in a browser to preview the downloaded script and confirm it appears harmless.
- Copy and paste the whole command into bash and execute it.
- Observe that the script downloaded by wget differs from the one previewed in the browser.
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 URL shortener like t.co redirects you to a longer web address. This report says that when the short link contained certain non-standard characters, the redirect sent the browser to one place but a command-line tool like wget to another. That means a person could check a link in a browser, see something safe, then run a command that actually downloads something harmful.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.