r/programminghorror • echo "Sub Mod" && :(){ :|:& };: • Oct 16 '25

Javascript Case randomization makes tracking images in emails undetected by anti-tracking software

Post image

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!

309 Upvotes

37 comments sorted by

View all comments

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.

123

u/[deleted] Oct 16 '25 edited Oct 17 '25

[removed] — view removed comment

18

u/wireframed_kb Oct 16 '25

Do they not? I would think they looked at a hash of the message or something, which would definitely differ with e and E.

13

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Oct 16 '25

I've noticed some detect by strings like utm_source=.

9

u/wireframed_kb Oct 16 '25

Google encourages the use of those tags, so I would assume at least some email providers do not.

I built a tracking system, but we just allow using cnames, and then appending a tracking ID that is generated from a sha hash. It seems to get through email filters well enough. It isn’t designed to track people, though, as much as unique sessions, so affiliate partners could be paid.

3

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Oct 16 '25

Sometimes, filters don't check for tracking links.

What I meant to say is essentially, "By default, Proton Mail only blocks known patterns tracking URLs. [Some URLs from the email I got regarding a Reddit TOS update a while ago slipped through the cracks, or could not be decoded into their original forms without automatically simulating a "click" on these links.] Therefore, in this case, Proton Mail probably would not detect this, so the person gets tracked unless they have images disabled entirely."

Of course, there are other places that detect tracking URLs, ads, etc. - but each one has different focuses.

1

u/wireframed_kb Oct 16 '25

The only thing required for an ID that is unique and can be assigned a user. I don’t know exactly how providers scan emails, but it seems odd if their method doesn’t differentiate between l and L, or I and l for that matter. (Uppercase I and lowercase L”). After all they’re unique values. Generating a hash seems the most obvious way, but any kind of encoding would read bitwise values.

Of course the system I built was a server-to-server principle, so instead of pulling an asset, it redirects users via a unique ID generated at time of click. Which means the link has no unique parameter, that is not generated until you hit the server and get redirected with a unique session ID. But problem is, however you build tracking, you either need to generate something to identify each user, or you need to make unique links. So given enough resources, it’s possible to guess whether there’s tracking.

2

u/MalusZona Oct 17 '25

if you use personal names in email - that would be absolent

7

u/turtle_mekb Oct 16 '25

case doesn't matter, just set the filename itself to random characters. if you control the backend, you can make all of them serve the actual image

4

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Oct 16 '25

all of them

How would you know who should receive the tracking data if the combination of random characters being queried weren't chosen ahead of time?

2

u/Circumpunctilious Oct 17 '25

I’m coming at this a little raw due to distraction, but hopefully something helpful:

You could hash the email address to produce a bit array that determines which letters should be capitalized, then the operation is deterministic for a particular email.

Alternatively, salt the case hash map with a per-session value.

1

u/turtle_mekb Oct 17 '25

no, of course you'd store a list of which string of characters was sent to which email address, just have the path in the URL be different entirely rather than just its casing

2

u/zigs Oct 16 '25

Ok, so webpage.cxm/image.png?tid=AAAAaaaaaAAAAaaAA