Phishing mail increasingly hides the link in a QR code image so URL checks never see it. Today the spam filter only collects URLs from the subject, text and HTML parts and text attachments (crates/spam-filter/src/analysis/url.rs, spam_filter_analyze_url); images aren't decoded at all.
Proposal: decode QR codes in inline images and PNG/JPEG attachments, add the URLs they contain to the URL set with their own location, and let the existing redirector, DNSBL and phishing checks score them, plus a tag for "the message's only link is inside a QR code". A QR code by itself shouldn't add score: invoices, tickets and 2FA setup mail carry them too. Off/on in the spam filter settings, new tags and scores in our bundled rules (3.0.2-inbuxa.N).
Things to settle first:
This decodes attacker-supplied images in the SMTP path. Check the size and dimensions before decoding (imagesize is already in the tree), cap the number of images per message, and run the decode off the async workers with a time limit.
Crate choice (an image decoder with only the PNG/JPEG features, plus rqrr or rxing); licenses and fuzzing.
It won't catch QR codes inside PDFs or drawn with HTML tables or Unicode block characters, which are common ways around exactly this check. Worth deciding whether those are in scope or a later step.
Suggested on the forum (https://community.coffeylabs.org/t/292) by StefanSa. Planned for after 27.1.
Phishing mail increasingly hides the link in a QR code image so URL checks never see it. Today the spam filter only collects URLs from the subject, text and HTML parts and text attachments (`crates/spam-filter/src/analysis/url.rs`, `spam_filter_analyze_url`); images aren't decoded at all.
Proposal: decode QR codes in inline images and PNG/JPEG attachments, add the URLs they contain to the URL set with their own location, and let the existing redirector, DNSBL and phishing checks score them, plus a tag for "the message's only link is inside a QR code". A QR code by itself shouldn't add score: invoices, tickets and 2FA setup mail carry them too. Off/on in the spam filter settings, new tags and scores in our bundled rules (`3.0.2-inbuxa.N`).
Things to settle first:
- This decodes attacker-supplied images in the SMTP path. Check the size and dimensions before decoding (`imagesize` is already in the tree), cap the number of images per message, and run the decode off the async workers with a time limit.
- Crate choice (an image decoder with only the PNG/JPEG features, plus `rqrr` or `rxing`); licenses and fuzzing.
- It won't catch QR codes inside PDFs or drawn with HTML tables or Unicode block characters, which are common ways around exactly this check. Worth deciding whether those are in scope or a later step.
Thanks to StefanSa for suggesting this in community t/292. Done in #463, and it ships in the next server release candidate.
The spam filter can now read QR codes in a message's pictures (PNG, JPEG, GIF and WebP, attached or as data: images in the HTML) and check each web link in them like the message's other links: blocklists, redirectors, look-alike names and the URL rules. Those links have locationqr_code, so a rule can single them out.
It's off unless you turn it on, because reading pictures costs some CPU time for each message that has them (a few ms for a bare QR code, around 0.1 s for a full-size phone photo). Turn it on under Settings › Spam filter › Filter settings › Images › Check links in QR codes (scanQrCodes on x:SpamSettings).
A message with such a link gets QR_CODE_URL, scored 0 in the bundled rules, since a QR code alone isn't a spam sign. To weigh it anyway, give it a score under Settings › Spam filter › Protection › Scores.
Limits: at most 4 pictures per message, each up to 4 MB and 16 megapixels, 1 s and 10 links per message, http and https links only.
Not covered: QR codes in PDFs, and ones drawn with HTML tables or text characters.
Thanks to StefanSa for suggesting this in community t/292. Done in #463, and it ships in the next server release candidate.
The spam filter can now read QR codes in a message's pictures (PNG, JPEG, GIF and WebP, attached or as `data:` images in the HTML) and check each web link in them like the message's other links: blocklists, redirectors, look-alike names and the URL rules. Those links have `location` `qr_code`, so a rule can single them out.
- **It's off unless you turn it on**, because reading pictures costs some CPU time for each message that has them (a few ms for a bare QR code, around 0.1 s for a full-size phone photo). Turn it on under **Settings › Spam filter › Filter settings › Images › Check links in QR codes** (`scanQrCodes` on `x:SpamSettings`).
- A message with such a link gets `QR_CODE_URL`, scored 0 in the bundled rules, since a QR code alone isn't a spam sign. To weigh it anyway, give it a score under **Settings › Spam filter › Protection › Scores**.
- Limits: at most 4 pictures per message, each up to 4 MB and 16 megapixels, 1 s and 10 links per message, http and https links only.
- Not covered: QR codes in PDFs, and ones drawn with HTML tables or text characters.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Suggested on the forum (https://community.coffeylabs.org/t/292) by StefanSa. Planned for after 27.1.
Phishing mail increasingly hides the link in a QR code image so URL checks never see it. Today the spam filter only collects URLs from the subject, text and HTML parts and text attachments (
crates/spam-filter/src/analysis/url.rs,spam_filter_analyze_url); images aren't decoded at all.Proposal: decode QR codes in inline images and PNG/JPEG attachments, add the URLs they contain to the URL set with their own location, and let the existing redirector, DNSBL and phishing checks score them, plus a tag for "the message's only link is inside a QR code". A QR code by itself shouldn't add score: invoices, tickets and 2FA setup mail carry them too. Off/on in the spam filter settings, new tags and scores in our bundled rules (
3.0.2-inbuxa.N).Things to settle first:
imagesizeis already in the tree), cap the number of images per message, and run the decode off the async workers with a time limit.rqrrorrxing); licenses and fuzzing.Thanks to StefanSa for suggesting this in community t/292. Done in #463, and it ships in the next server release candidate.
The spam filter can now read QR codes in a message's pictures (PNG, JPEG, GIF and WebP, attached or as
data:images in the HTML) and check each web link in them like the message's other links: blocklists, redirectors, look-alike names and the URL rules. Those links havelocationqr_code, so a rule can single them out.scanQrCodesonx:SpamSettings).QR_CODE_URL, scored 0 in the bundled rules, since a QR code alone isn't a spam sign. To weigh it anyway, give it a score under Settings › Spam filter › Protection › Scores.