Leaky Diodes
Leaky diode is a data exfiltration test tool for smart data diodes, that is data diodes with support for TCP pass-through with the help of some side channel from the isolated side. The attacks used are flow modulation and/or close delay:
-
CLOSE DELAY uses the delay between the request of one the secret's bits and the time the server closes the connection to encode the bit value. (i.e.- 10 seconds delay means a 0, 30 seconds delay a 1)
-
FLOW MODULATION uses tcp flow control mechanism to encode secret's bits as a transfer speed. For example if the the bit requested by the client is 1 the server throttles the speed to 300KB/s, if it's 0 to 100KB/s. The advantage of this attack is that using a single connection makes it harder to detect.
Installation
Download the package or clone the repository, and then install with:
python3 setup.py install
or use pypi:
pip install leaky_diode
Usage
On the isolated side launch the server:
leaky_server public_ip port 'secret string that needs leaking'
On the untrusted side launch the client and select one of the attacks,
leaky_client server_ip server_port --mode flow --partial
or
leaky_client server_ip server_port --mode close --partial
And just wait a few minutes to receive the first byte (it's the slowest), if you're not sure if it's working add --verbose option so it prints messages on each received bit.
Options
usage: leaky_client [-h] [--mode mode] [--low_delay delay] [--high_delay delay] [--low_rate rate]
[--high_rate rate] [--sample_time time] [--settle_time time] [--partial]
host port
Leaky Diode is a data exfiltration test tool for data diodes
positional arguments:
host Remore host address
port Remote host port
optional arguments:
-h, --help Show this help message and exit
--mode mode, -m mode Attack mode 'flow' or 'close' (default: flow)
--low_delay delay Close delay for low bits (default: 5s) (only Close Mode)
--high_delay delay Close delay for high bits (default: 10s) (only Close Mode)
--low_rate rate Tx rate for low bits (default: 64 KB/s) (only Flow Mode)
--high_rate rate Tx rate for high bits (default: 300 KB/s) (only Flow Mode)
--sample_time time Tx rate sampling interval (default: 3.0s) (only Flow Mode)
--settle_time time Settle time between sending a bit request and the start of
sampling (default: 8.0s) (only Flow Mode)
--partial Show partial results each time another byte from the secret is received
--verbose Show debugging messages
usage: leaky_server [-h] host port secret_string
Leaky Diode is a data exfiltration test tool for data diodes
positional arguments:
host Remore host address
port Remote host port
secret_string Attack mode 'flow' or 'close' (default: a secret string)
optional arguments:
-h, --help Show this help message and exit
-v, --verbose Show debugging messages
Performance
The attack throughput with the default parameters is around 1 B/min (yes, one byte per minute), you can increase it by lowering the delay times in close delay mode, and the settle/sample times in flow modulation (the default values are very conservative)
An actual exfiltration attempt using this attack could easily leak a few KB per day, too slow for large breachs, but enough for targeted attacks for keys/passwords or selected users data.
API
It is also possible to use leaky_diode as a package and include a server in your own app:
-
class LeakyServer(host, port, secret, ticks=100, max_connections=10)
-
host: (str) Listen interface ip addres ('' for all)
-
port: (int) Listen port
-
secret: (bytes) Secret to leak (max length 65535)
-
ticks: (int) Ticks per second the worker process use to throttle the connections.
-
max_connections: (int) Max concurrent connection the server can handle.
-
start(): Initialize and launch server worker processes
-
stop(): Stop server and its workers
-
from leaky_diode import LeakyServer
leaky_server = LeakyServer('192.168.0.10', 9000, b'some secret byte string')
leaky_server.start()
# Do something else
......
# Close server before exit
leaky_server.close()
TODO
- Harden message parsing input validation (invalid lengths)
- Use concurrent connection to increase exfiltration speed.
- Tune flow modulation mode tx speeds .
- Tune close delay mode delays.
- Add CRC to the secret and secret length, or even better error correction.
- Add resume capability so there is no need to get the secret in one go.
- Add some tests.
References
- Data Diodes Wikipedia
- Place holder so I remember to publish a post on the attacks
- And another on transport and streaming protocols for data diodes
Metadata
Release files for leaky-diode 0.1.1
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 |
|---|---|---|---|---|
| leaky_diode-0.1.1.tar.gz | 14.9 kB | Without provenance | Details for leaky_diode-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| leaky_diode-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for leaky_diode-0.1.1-py3-none-any.whl |
Total release size: 43.0 kB
Release files / leaky_diode-0.1.1.tar.gz
| Download URL | leaky_diode-0.1.1.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e60521311bedfc16b17dd22653d788015f95b3f4f7bf0a813bede36e04bd2b8b
|
|
BLAKE2b-256 checksum How to use checksums |
739a48091d597402e228a6de1921651fb979117d12ecdfc572d23a0619852976
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.5.3
|
Release files / leaky_diode-0.1.1-py3-none-any.whl
| Download URL | leaky_diode-0.1.1-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9d68ad1f427e2d65d8d38425313bde04c62f2d071d413df1ccf269fa29691b1
|
|
BLAKE2b-256 checksum How to use checksums |
5da58e14511e055bebfe436a119ff58baaa7d99d414cf168d3910cf56a2c7bf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.5.3
|
Security for leaky-diode 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.