Skip to main content

Command Injection Tester

The command-injection-tester script allows for straightforward testing of email servers for the STARTTLS command injection vulnerability in SMTP, POP3, and IMAP.

Usage

The command

python3 command-injection-tester --imap --pop3 --smtp <hostname>

tests <hostname> for the command injection in IMAP, POP3, and SMTP.

Parameters

  • --help (-h): Print help message.
  • --imap: Use the IMAP protocol
  • --pop3: Use the POP3 protocol
  • --smtp: Use the SMTP protocol
  • --imap-port (-i): IMAP port to check (default: 143)
  • --pop3-port (-p): POP3 port to check (default: 110)
  • --smtp-port (-s): SMTP port to check (default: 587)
  • --quiet (-q): Be less verbose
  • --timeout (-t): Timeout in seconds to use for network sockets. Increase in case of problems (default: 2)
  • --logdir (-l): Path to log directory (default: ./logs)

Example:

The Command Injection Tester can best be tested using the Fake Mail Server:

  1. Start the Fake Mail Server:
$ sudo ./fake_mail_server setup
  1. Run this script against the server:
$ python3 command-injection-tester --imap --pop3 --smtp localhost
  1. Since the Fake Mail Server is intentionally vulnerable against the command injection, you should see Command injection here! after every protocol test.

Testing live servers should be just as easy. If connections keep timing out/the sanity test keeps failing, try increasing the timeout using the --timeout parameter.

Background

This tool was published as part of our research on security vulnerabilities in STARTTLS:

Metadata

Release files for command-injection-tester 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for command-injection-tester 0.0.2
File Size Uploaded
command-injection-tester-0.0.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for command-injection-tester 0.0.2
File Interpreter ABI Platform
command_injection_tester-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / command-injection-tester-0.0.2.tar.gz

Download URL command-injection-tester-0.0.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
03e8b67bfc2876dc8c2016d7331470341f4d1ef287603da05498e4878c9ccfb7
BLAKE2b-256 checksum
How to use checksums
5b53ffc5b2a806f2d2d895d5d043dcdf37405b87aa8a70bc28d042f9bafd7111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

Release files / command_injection_tester-0.0.2-py3-none-any.whl

Download URL command_injection_tester-0.0.2-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
762ebeefba7255c3f69e5311df0dad033186e4d2c4f119a23120e3f75209c364
BLAKE2b-256 checksum
How to use checksums
14f6d1569d5161da553e3ba6dee2f6ce18595bf5ac7ae4907b4e7f90a69f438b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page