Skip to content

Security: Iman/javid-steganography

Security

SECURITY.md

Security Policy

Report privately. Always.

Report a security problem through GitHub private vulnerability reporting. Open the Security tab of this repository and select "Report a vulnerability". That opens a thread only the maintainer can read. If that route is not open to you, use the contact route on the project's GitHub page.

Do not open a public issue, a pull request, a discussion post, or a social media thread first.

The reason is what a public report does here. A detection method published in an issue can be run against every image a platform holds, on the day it is published, by anyone. It does not have to work well to be dangerous. A scan that flags one image in ten thousand produces a shortlist of people to go and visit. Meanwhile the images that are already sent cannot be recalled, and the people who sent them cannot be warned in time.

So a fix takes weeks and a scan takes an afternoon. Report privately.

The threat model

The attacker is not trying to read the message. The attacker is trying to notice that a message exists.

That is the whole of it, and it is the opposite of the threat model for an encryption tool. If someone is found with an image that is provably carrying a hidden payload, the content is almost beside the point. The fact of concealment is the finding, and it is enough. A cipher that holds perfectly protects nothing if the container announces itself.

Give the attacker these abilities, all of which are cheap and real:

  • They already have the file. WhatsApp, Telegram, and X hold every image that passed through them. Detection does not require touching a device.
  • They can scan at scale. Testing millions of images for a fixed byte pattern costs almost nothing. Statistical tests cost more and are still affordable.
  • They can accept a bad false-positive rate. A commercial product could not. A state body building a list of people to question can.
  • They may have the original cover image. If the cover came from Wikipedia, a news site, or a stock library, a byte comparison against the original ends the question immediately.
  • They can seize the device. Then they have the shell history, the browser history, and possibly this repository.

The design decision at the centre of this project pulls against that threat. The ROBUST method survives recompression because it modifies the image strongly, by a fixed luminance differential across 8 by 8 blocks. Strength is exactly what makes a modification statistically visible. "Survives recompression" and "hard to detect" are traded against each other, and this tool trades toward survival. An attacker will test that trade. Test it too.

Known weaknesses. Do not report these as new.

These are documented so that nobody spends a week finding them again. Each one is real. Work that closes one, or that measures how expensive it actually is to exploit, is very welcome. A report that says only "this exists" is not.

1. The file-structure methods carry a fixed marker in the clear. text-image-simple.py and text-image-advance.py write the constant bytes DE AD BE EF before the payload. image-to-image-simple.py writes CA FE BA BE. Measured on a freshly generated 800 by 600 cover image: after hiding a 26-character message, the marker sits in the clear at byte offset 2,299 of a 2,373-byte PNG. Finding it needs no statistics and no cryptography, only a search for four bytes. This applies to the DEFLATE, COM, and append methods. The ROBUST method does not carry a marker.

2. Trailing data is itself anomalous. Even with the marker removed, a PNG with several hundred bytes after IEND, or a JPEG with data after the EOI marker, is unusual. That is a one-line detector on its own.

3. The cipher keystream repeats every 32 bytes. Key derivation is PBKDF2-HMAC-SHA256 with 100,000 iterations and a random 16-byte salt. That part is sound. The salt is fresh per message, so two messages never share a keystream. The encryption step is then data[i] ^ key[i % 32]. Any message longer than 32 bytes reuses key material. Persian and Arabic text makes that worse than it sounds: those characters encode in UTF-8 as two bytes whose lead byte comes from a set of four values, so roughly half the plaintext bytes are close to known. Structured plaintext plus a repeating key is the classical setting for recovering a keystream.

4. CRC32 is an error check, not a message authentication code. XOR is malleable. Someone who can alter the file and who knows or guesses the plaintext can change the message and recompute the checksum. The tool tells the recipient the payload is intact. It cannot tell them who wrote it.

5. The password goes on the command line. Every example in the README passes the password, and often the message text, as an argument. Both land in ~/.bash_history or ~/.zsh_history, and both are visible in the process list to any other user on the machine while the command runs. On a seized device, the shell history is among the first things read. This defeats the tool completely and it is independent of how good the steganography is.

What counts as a vulnerability

  • A detector. Any method that separates images made by these tools from clean images better than chance. Say the false-positive rate, the corpus size, and which tool and method you tested. A detector for the ROBUST method is the most valuable single report this project can receive, because ROBUST is what people use when they send a photo rather than a document.
  • A way to recover the message without the password.
  • A way to recover the password faster than brute force against PBKDF2 at 100,000 iterations.
  • Anything in the output file that identifies the sender, the machine, the time, or the tool version, beyond the markers already listed above.
  • A case where a tool writes plaintext, the password, or the payload somewhere the user would not expect: a temporary file, a crash dump, a log line, an error message.
  • A wrong entry in the platform compatibility table, in the direction that costs the user. A user reads that table and bets on it. If it says a payload survives and it does not, the message is silently lost. The user then sends it again, which puts two flagged images on the wire instead of one.
  • A README instruction that puts the user at more risk than the README admits. Documentation here is part of the tool.

What does not count

  • "Steganography is detectable in principle." Yes. Say which method, on what corpus, at what rate.
  • The five known weaknesses above. Send a fix or a measurement.
  • "A weak password can be guessed." Use a strong password.
  • A platform changing its image pipeline. Platforms change. A stale row in the compatibility table is an ordinary issue, not a security report, unless it fails in the direction described above.
  • Failure on a platform that is not in the table. Only the listed platforms and modes are tested.
  • Anything that needs the password. The password holder is the recipient.
  • The 500-character limit and the other documented capacity limits.
  • Metadata that the sending platform adds or strips. That is the platform's behaviour, not this tool's.

What to put in a report

The tool, the method, the exact command, and what you observed. If you built a detector, include the corpus description and the rates, not the corpus.

Never attach a real stego image from a real conversation, or a message somebody actually sent. Generate a fresh cover image and a throwaway message:

python text-image-advance.py create-cover 800 600 cover.png

Do not include your location, your operator, or your platform account. See CODE_OF_CONDUCT.md.

What you get back

One maintainer works on this, so these are targets and not guarantees:

  • An acknowledgement within 7 days.
  • An assessment within 14 days: accepted, not accepted, or still open, with the reason.
  • A fix, or a written statement of why there will not be one.

If 14 days pass with no reply, send it again. Silence is a missed message, not a decision.

There is no bounty. This project has no money in it.

Credit is yours if you ask for it, and is off by default. Do not put your name, your country, or your employer in a report unless you are content for it to become public.

Disclosure timing is agreed with you. For a detection method the default is slower than usual, because a fix does not help anybody whose images are already sent. The first thing to publish is normally the advice, and the method after it.

There aren't any published security advisories