geteilt von: https://lemmy.dbzer0.com/post/4500908

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.

  • Ja und nein. Ich muss zugeben, dass ich die Technologie dahinter nie ganz verstanden habe, aber die Menschen die sich den ganzen Tag mit Urheberrechtsverletzungserkennung beschäftigen waren klug genug diese Hashes so zu bauen, dass ähnliche Bilder ähnliche Hashes produzieren (im Gegensatz zu kryptographischen Hashes bei denen genau diese Eigenschaft unerwünscht ist). Man kann damit wohl so eine Art “Distanz” definieren. Je nach dem wie man dann seinen Threshold für erlaubte Distanzen zu den Hashes in der Datenbank setzt hat man mehr/weniger falsche Ergebnisse. Soweit mein Halbwissen dazu.

    • Ja, mehr Details dazu findest du unter “perceptual hashing”. Ist aber dann halt wieder AI mir allen vor und Nachteilen. Außerdem sind auch die nicht gegen alles gefeit.

      Kannst du ein Bild von dem Pferd machen, erkennt die AI richtig als harmloses Bild eines Pferdes. Hälst du nen Apfel davor wird’s plötzlich als porno erkannt. Das Problem lässt sich ein bisschen umgehen, indem man die Berechnung des hashes nicht öffentlich macht, also als closed source betreibt. Dann wird’s schwerer herauszufinden wie genau der Apfel aussehen muss, damit das Ergebnis als porno erkannt wird. Aber dann bist du ja wieder von ner anderen Instanz abhängig, die dir irgendwas zurückschicken kann.

      Hier ein Link zu einer Diskussion, wo vor zwei Jahren, als das zum ersten Mal aufkam, einige Leute sehr viel Spaß dabei hatten eines solcher perceptual hashing neuronalen Netze zu verarschen. Sehr unterhaltsam zu lesen.

      • Ich hatte dabei an sowas wie z.B. contentID von Google gedacht. Da hatte ich mal nen Vortrag zu gesehen und das klang nicht so als wäre da (zumindest damals nicht) ai im Spiel. Der Typ von Google durfte uns natürlich auch nicht genau verraten wie das funktioniert.

        Ist aber eigentlich auch egal, jedes dieser Systeme wird Fehler machen dafür ist unerheblich ob der Hash jetzt mit einer KI oder einem anders gearteten Algorithmus erstellt wird.

        Der Punkt ist: wenn diese Distanz Berechnung tatsächlich funktioniert musst du das pornographische Material so weit verändern, dass es unattraktiv wird. Im Sinne von “ein bisschen zuschneiden oder ein Wasserzeichen” reichen nicht aus

        • Ja, mit 100 Millionen Dollar an Investitionen kann man da was einigermaßen brauchbares auf die Beine stellen. Das Problem für Lemmy ist, dass man sich entweder auf eine externe Blockliste verlassen mus (was du ja kritisiert hast: “Du verlässt dich dann aber darauf, dass diese externe Quelle dir nicht auch Checksummen für anderes Material liefert, dass du dann ausversehen mit-blockst”), oder man nimmt einen open source Ansatz, der aber missbraucht werden kann, wie in der GitHub Diskussion gezeigt, die ich verlinkt habe.

          Es gibt nur diese zwei Optionen. Und wenn du die closed source Lösung kritisierst aber drei Kommentare später sagst, dass Google es ja auch hin bekommt, weiß ich nicht wie und worüber wir hier diskutieren wollen.

          • Ich wollte nur deiner Pauschalen Aussage

            Bei hashes reicht schon ein einfaches Wasserzeichen oder ein bisschen zuschneiden, damit das Bild anhand des Hauses nicht mehr erkannt wird.

            widersprechen, damit andere weniger versierte Leser den kompletten Kontext haben können. Es gibt die Technologie das besser zu machen, es ist nicht pauschal notwendig, dass die Erkennung so schlecht ist, dass sie sich durch einfache Änderungen austricksen lässt. Die Technologie ist aber wie du richtig sagst nicht für alle zugänglich sondern prohibitiv teuer.

            Außerdem sehe ich nicht das Problem dabei alle möglichen Alternativen zu kritisieren, wenn sie nunmal kritikwürdige Eigenschaften haben. Extern Blocklisten haben eben das Vertrauensproblem. Der Opensource Ansatz kann momentan missbraucht werden. Der theoretisch saubere Ansatz ist sau teuer.

            Ich wollte auch eigentlich keine große Diskussion anfangen, ich wollte wie gesagt nur weiteren Kontext zu deiner mMn zu pauschalen Aussage hinzufügen.

      • Ich hab ehrlich gesagt bei meiner ersten Antwort ein bisschen über den Claim “perceptual hash ist AI” drüber gelesen. Ich hab jetzt mal ein bisschen weiter gegooglet. Die meisten Algorithmen sehen nicht so aus als würden sie irgendwo ein Model ausführen. Bei z.B. pHash geht das aber wohl über eine Transformation in die Frequencydomain in der dann aus einem Abschnitt der Hash gebildet wird.

        Wie gut oder schlecht die sind kann ich natürlich auch nicht sagen ohne jetzt weiter zu googlen. Da gibts wahrscheinlich zu jedem Algorithmus auch wieder Ansätze um den jeweiligen zu brechen/umgehen. Facebooks PDQ ist aber wohl an pHash angelehnt [2].

        Was es gibt ist “deep perceptual hashing” das ist anscheinend was Apple verwendet und was wohl eher ungeeignet ist wie dein github link und diese Publikation [1] sagen.

        Interessanter Ausflug in Themengebiete mit denen ich sonst wenig zu tun habe :)