HTTP GZIP Compression remote date and time leak
jcarlosnorte.com
jcarlosnorte.com
Use UTC.
http://yellerapp.com/posts/2015-01-12-the-worst-server-setup...
In a SQL database a time field should be an unsigned bigint.
Tor is not to blame here, and gzip or most webservers probably neither. It's an unforseen side effect by a combination of tools.
The article provides a script to test if a server reveals the date and timezone or not.
Roundtripping the file's mtime through compression/decompression is convenient. Same reason why the original filename can be stored (roundtrip it in case the filename is truncated at one point e.g. by having the gzip archive move through an msdos system). Here's how the spec defines it:
MTIME (Modification TIME)
This gives the most recent modification time of the original
file being compressed.
Sadly the spec then goes on to recommend leaking the compression date: The time is in Unix format, i.e.,
seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this
may cause problems for MS-DOS and other systems that use
local rather than Universal time.) If the compressed data
did not come from a file, MTIME is set to the time at which
compression started. MTIME = 0 means no time stamp is
available.
However note that the spec recommends a unix timestamp, which is ~UTC, and doesn't include the space for a timezone. Reading the POC[0] it apparently assumes any non-zero mtime is immediate (ignoring cached assets) and local.[0] https://github.com/jcarlosn/gzip-http-time/blob/master/time....
They can't include the timezone since the field is a unix timestamp, there's no room for the timezone.
Apparently the script just assumes whichever date is stored in the mtime field is a local date (when the spec suggests UTC/GMT): https://github.com/jcarlosn/gzip-http-time/blob/master/time....
http://docs.aws.amazon.com/AmazonCloudFront/latest/Developer...
Article seems to fail to notice that gzip timestamps are specced to be timezone-independent, and two of the three example domains at the end of the article adhere to that spec. We don't know what happens to the article's "10%" number after servers that adhere to the spec are removed from the data. For all we know bing.com could be the only service that leaks this info.
1) Timezone of server is set to one other than the geographical location's
2) Gzip-compressed page or asset is cached. Therefore the embedded date/time is from an unknown past.
So this reduces the good guesses a bit.
The first I could think of is the TLS handshake, but it's GMT and several implementations don't set it any more to a valid value (they use a random value instead). Various image formats use timestamps, they seem to be timezone unaware.
Probably something to look into, and probably a good idea to question whether we need timestamps everywhere. If they don't serve a useful purpose better skip them. (They also happen to be a major issue with things like reproducible builds.)
(Why does GZIP needs a compression date again?)
It really shouldn't be in the context of hidden services, considering your setup has to be seriously flawed for the webserver to be able to divulge any information about it's physical location.
Perhaps it'd help with attacking some RNGs, but beyond that it's really just a novelty.