699
submitted 11 months ago by db0@lemmy.dbzer0.com to c/div0@lemmy.dbzer0.com

In the past months, there's a been a issue in various instances where accounts would start uploading blatant CSAM to popular communities. First of all this traumatizes anyone who gets to see it before the admins get to it, including the admins who have to review to take it down. Second of all, even if the content is a link to an external site, lemmy sill caches the thumbnail and stores it in the local pict-rs, causing headaches for the admins who have to somehow clear that out. Finally, both image posts and problematic thumbnails are federated to other lemmy instances, and then likewise stored in their pict-rs, causing such content to be stored in their image storage.

This has caused multiple instances to take radical measures, from defederating liberaly, to stopping image uploads to even shutting down.

Today I'm happy to announce that I've spend multiple days developing a tool you can plug into your instance to stop this at the source: pictrs-safety

Using a new feature from pictr-rs 0.4.3 we can now cause pictrs to call an arbitary endpoint to validate the content of an image before uploading it. pictrs-safety builds that endpoint which uses an asynchronous approach to validate such images.

I had already developed fedi-safety which could be used to regularly go through your image storage and delete all potential CSAM. I have now extended fedi-safety to plug into pict-rs safety and scan images sent by pict-rs.

The end effect is that any images uploaded or federated into your instance will be scanned in advance and if fedi-safety thinks they're potential CSAM, they will not be uploaded to your image storage at all!

This covers three important vectors for abuse:

  • Malicious users cannot upload CSAM to for trolling communities. Even novel GenerativeAI CSAM.
  • Users cannot upload CSAM images and never submit a post or comment (making them invisible to admins). The images will be automatically rejected during upload
  • Deferated images and thumbnails of CSAM will be rejected by your pict-rs.

Now, that said, this tool is AI-driven and thus, not perfect. There will be false positives, especially around lewd images and images which contain children or child-topics (even if not lewd). This is the bargain we have to take to prevent the bigger problem above.

By my napkin calculations, false positive rates are below 1%, but certainly someone's innocent meme will eventually be affected. If this happen, I request to just move on as currently we don't have a way to whitelist specific images. Don't try to resize or modify the images to pass the filter. It won't help you.

For lemmy admins:

  • pictrs-safety contains a docker-compose sample you can add to your lemmy's docker-compose. You will need to your put the .env in the same folder, or adjust the provided variables. (All kudos to @Penguincoder@beehaw.org for the docker support).
  • You need to adjust your pict-rs ENVIRONMENT as well. Check the readme.
  • fedi-safety must run on a system with GPU. The reason for this is that lemmy provides just a 10-seconds grace period for each upload before it times out the upload regardless of the results. A CPU scan will not be fast enough. However my architecture allows the fedi-safety to run on a different place than pictrs-safety. I am currently running it from my desktop. In fact, if you have a lot of images to scan, you can connect multiple scanning workers to pictrs-safety!
  • For those who don't have access to a GPU, I am working on a NSFW-scanner which will use the AI-Horde directly instead and won't require using fedi-safety at all. Stay tuned.

For other fediverse software admins

fedi-safety can already be used to scan your image storage for CSAM, so you can also protect yourself and your users, even on mastodon or firefish or whatever.

I will try to provide real-time scanning in the future for each software as well and PRs are welcome.

Divisions by zero

This tool is already active now on divisions by zero. It's usage should be transparent to you, but do let me know if you notice anything wrong.

Support

If you appreciate the priority work that I've put in this tool, please consider supporting this and future development work on liberapay:

https://liberapay.com/db0/

All my work is and will always be FOSS and available for all who need it most.

top 50 comments
sorted by: hot top controversial new old
[-] C0balt_Blu@lemmy.ml 70 points 11 months ago

Db0 the fuckin hero 🙏

[-] Blaze@discuss.tchncs.de 38 points 11 months ago
[-] Demigodrick@lemmy.zip 36 points 11 months ago

Just want to add - i've been using this (via my desktop!) for my instance for a little while now and its great - While the evidence shows there are false positives, i've yet to see it affect anything in real time.

Beware your B2 transaction costs though! 😭 I'm sure there is a cheaper way to do it but backblaze costs went up quite a bit.

load more comments (2 replies)
[-] breakingcups@lemmy.world 27 points 11 months ago

How does one even test this ethically?

[-] Carighan@lemmy.world 23 points 11 months ago

There are I think official "training kits"? I remember reading about this, there are sets of data you can get to train CSAM detection with.

[-] poVoq@slrpnk.net 20 points 11 months ago

Its a general image classifier. You don't need to train it specifically on CSAM if you are willing to accept a certain false positive rate.

[-] hikaru755@feddit.de 15 points 11 months ago

I think "legally" and "without constantly wanting to vomit" is the trickier question. From a purely ethical standpoint I don't see a problem with taking CSAM that's apparently already flooding Lemmy and using it to test whether your filter works before nuking it. At least as long as you're making sure you're not exposing anyone else to it.

[-] AceQuorthon@lemmy.dbzer0.com 20 points 11 months ago
[-] KpntAutismus@lemmy.world 30 points 11 months ago

Child Sexual Abuse Material. Child porn.

load more comments (1 replies)
[-] Saeculum@hexbear.net 11 points 11 months ago

Child sexual abuse materials. Vile shit

load more comments (1 replies)
[-] Lemmyvisitor@lemmy.dbzer0.com 19 points 11 months ago

I'm curious how an AI like this is trained

[-] Zeus@lemm.ee 17 points 11 months ago

holy hell this is massive

thank you for your work db0

[-] iByteABit@lemm.ee 17 points 11 months ago

Great work, this is the biggest issue that Lemmy has a the moment, I hope the admins will be able to set this up easily and start to take back all the preventative measures.

[-] Outdoor_Catgirl@hexbear.net 17 points 11 months ago

Has this been a problem since the initial spam wave? I wasn't aware the issue was ongoing. But the less pedos, the better.

[-] lemann@lemmy.one 19 points 11 months ago

External images aren't federated to Hexbear, so your instance is mostly unaffected by the disgusting trolls doing this stuff.

From what I've been hearing, it's sadly been still ongoing :(

[-] carl_marks_1312@hexbear.net 10 points 11 months ago

hexbear dub. big salute to the admins and mods rat-salute

[-] GarbageShoot@hexbear.net 9 points 11 months ago

Some major instances like .ee shut down image uploads immediately and only restored them in a truncated fashion, if at all.

[-] Awoo@hexbear.net 16 points 11 months ago* (last edited 11 months ago)

Cool. After some testing Hexbear should run it. Not that the problem has ever been serious for Hex but still worthwhile and work that should absolutely be supported.

load more comments (1 replies)
[-] GarbageShoot@hexbear.net 16 points 11 months ago

I think people are going to be much more concerned about the false negative rate than the false positive rate.

[-] fmstrat@lemmy.nowsci.com 14 points 11 months ago

Have you considered federating hashes of positive matches and working with the Lemmy team to not outward federate on a local positive match (and potentially have the hash go instead)?

The former can reduce overhead and electricity use, and the latter will stop more distribution and aid those sans-GPU who can't run it.

Over time, the hash DB will grow and get better. In addition, perhaps there is metadata that can be used to track image similarity to positive matches to reduce false-positives, but I imagine that algorithm would be much more complicated.

[-] db0@lemmy.dbzer0.com 24 points 11 months ago

Hashes won't work for novel GenerativeAI images. For this kind of thing we need to be sharing tensors and comparing distances so that it catches format changes and compression artifacts. Theoretically possible. Practically, I don't know how feasible it is.

load more comments (3 replies)
[-] Cyberflunk@lemmy.world 14 points 11 months ago
[-] db0@lemmy.dbzer0.com 12 points 11 months ago* (last edited 11 months ago)

Not for all csam and not at all for novel generative ai csam. It's also not for all countries nor is it easy for everyone to join it and not everyone wants to be on cloudflare. Same is true for other tools like photodna

load more comments (3 replies)
[-] Eheran@lemmy.world 13 points 11 months ago

False positive rate ~1 % False negative rate?

[-] marco@beehaw.org 12 points 11 months ago

Sent you a little bit of money, @db0@lemmy.dbzer0.com - it sucks that this is necessary, but thanks for doing the good work <3

load more comments (1 replies)
[-] user@lemmy.one 12 points 11 months ago

👏well done.

load more comments
view more: next ›
this post was submitted on 20 Sep 2023
699 points (97.6% liked)

/0

1505 readers
12 users here now

Meta community. Discuss about this lemmy instance or lemmy in general.

Service Uptime view

founded 1 year ago
MODERATORS