Skip to content
Info disclosure Disclosed report Advanced

Profile Pic padding (Length-hiding) fails due to use of GZIP

Twitter padded profile images to fixed byte-length thresholds to hide their true sizes from network observers, but GZIP compression was later enabled for those images, which removes the padding benefit. An attacker who can observe response lengths could again infer which pages a user visits from the size of Twitter image responses.

ericlaw Follow

Originally disclosed on HackerOne

Bounty$280 View original
  • Triaged in 4 hours
  • Fixed in 2 months
  • Paid in 17 days
  • Disclosed after 17 months

Back in August, I noted that Twitter was appending anywhere from dozens to thousands of junk (0x20) bytes on the end of the JPEG and PNG files they serve for users’ profile images. It was suggested that, though invalid, they were doing this deliberately, as an information-hiding mechanism.

The HTTPS protocol encrypts all of the data transferred over it, but it doesn’t hide the length of that data. Because Twitter profile pictures can appear in predictable patterns on 3rd-party pages, an otherwise “blind” network attacker could infer what pages a user was visiting based on the length of responses from Twitter’s image server. So, Twitter selected a number of common byte length thresholds and they pad images to those sizes. So, for instance, a 10174 byte image is padded with 6124 bytes of data to yield a 16298 byte response, while a 11502 byte response is padded with 4796 bytes to yield a matching 16298 byte response. Fiddler now detects this padded at the end of PNG files and surfaces it:

Unfortunately it seems that Twitter's Performance team wasn't aware that this padding was intentional and they mistakenly enabled GZIP compression for these images. That change improves performance, but circumvents the length-blinding padding effort.

The original report as published on HackerOne, by ericlaw. 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

Likely a performance change enabled GZIP compression on padded images without realising the padding was a deliberate length-hiding measure, so compression removed the size uniformity.

Impact

A blind network attacker could infer which pages a user visits from the length of responses from Twitter's image server, because the padding no longer equalises sizes.

What the attacker needed

Attacker can observe response lengths; victim loads pages with Twitter images

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 you load a web page, the data is encrypted, but the size of each response can still be seen by someone watching the network. If a picture always has the same size, an observer cannot tell which picture it is; Twitter padded images to make many of them the same size. Turning on GZIP, a compression method that shrinks data before sending, made the sizes different again, so the hiding no longer works.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by ericlaw

View all

3 more disclosed reports, best first.

More from X / xAI

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.