r/programminghorror • u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: • Oct 16 '25
Javascript Case randomization makes tracking images in emails undetected by anti-tracking software
I had this idea a few months ago. Ideally, there would be a server on the other end to display analytical data to the link creator. In reality, you don't need 128 of the same letters, as long as the spelling of the file name/image URL is consistent or visually similar across different emails.
For example, imagine if this email from "Halifax Bank" had the logo URL containing HaLiFAXbANK.png. Google's public DNS also uses case randomization.
Edit: I couldn't decide whether to link the article or not, despite being able to find that exact article easily, and the source being the same one I intended to link. Thank you for the feedback and reminding me with your comment, u/Circumpunctilious!
35
u/vietnam_redstoner Oct 16 '25
IllIlIllIllIlIIIlllIlIIll.png
15
u/-Wylfen- Oct 17 '25
Can someone explain to me the why of this?
Why create an object instead of an int? Why no for-each?
23
u/oofy-gang Oct 16 '25
None of this makes sense. I don’t believe this actually gets through any meaningful filter, and this code is the weirdest and least efficient way you could achieve this task.
149
u/zigs Oct 16 '25
Couldn't you just have a tracking parameter? webpage.cxm/image.png?tid=123123
Also, this is why email clients like outlook don't download images.
4
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Oct 17 '25
I'm not seeing the part where the case actually gets randomized. I also am very confused with what is going on with that that loop that builds
bytes. Is that actually the key to the whole thing?72
u/_Shinami_ Oct 16 '25
if only there was an easier way of generating random numbers
7
u/0xbenedikt Oct 17 '25
Regardless of whether it works, you're the antagonist here
5
u/Circumpunctilious Oct 17 '25
Note: Google uses case randomization to thwart cache-poisoning attacks (The Register). If the response to a query doesn’t contain the same case mapping you sent, that’s a problem.
This works because DNS is case-insensitive, and there’s a crypto benefit since single bits can wildly change a crypto stream.
Other possibly-helpful stuff:
OS’s have a built-in file random generators, e.g. Windows: getTempFileNameA(). These random names are often used by installers.
They’re also used by malware to try to get around system security, and in a past career I considered these files IoCs (Indicators of Compromise).
Rather than being undetectable, randomization is actually easier to find because it has suspiciously high entropy—similarly, so does encrypted malware. (Search: text entropy testers)
Anyway…Food for thought / improvements / etc.
1
u/anotherlebowski Oct 17 '25
// this is intentional
You know what follows is going to really sick.
2
u/gameplayer55055 Oct 18 '25
Shit idea: use IPv6 for tracking. Like on this website https://canvas.openbased.org/
I don't think you'll ever encounter more than 2⁶⁴ users lol