Repository navigation
fix(aitm): make the cookie AiTM demo work end to end (audit C1) - #9
Merged
Merged
Conversation
The headline evilginx capture flow could not complete out of the box (audit C1). This fixes the demo so a lure proxies to a real upstream and captures a session, and hardens the launcher around it. - demo-cookie phishlet now proxies to a reachable HTTPS upstream (app.cookie-demo.test) distinct from the lure host, instead of pointing its upstream at the lure and looping (C1.4). - demos/cookie serves HTTPS when TLS_CERT/TLS_KEY are set; new 'make demo-cookie-tls' stands it up as the upstream (C1.4). - configure_lure.py: port-aware, socket-based bind poll with ss/lsof fallback and a re-check after the process is up, so it stops reporting a false negative on a successful bind (C1.3); honors EVILGINX_HTTPS_PORT / EVILGINX_DNS_PORT for unprivileged high ports (C1.2); tears down the screen session on failure (L1). - evilginx_ctl: tear down a failed start; clearer privileged-port guidance. - ensure-destination reuses an existing phishlet with the same landing host instead of scaffolding a colliding duplicate (C1.5). - upstream_domain handles single-label and compound public suffixes (M1). - make setup installs pexpect into venv and checks for screen (C1.1). Tests: Rust unit tests for upstream_domain, host parsing, and phishlet reuse; Python unit tests for the launcher; an unprivileged smoke test of the HTTPS upstream + cookie capture surface; a sudo full-loop script; and a CI job that runs the Python tests and smoke test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the bundled AiTM cookie demo work end to end and hardens the lure launcher
around it. This is the audit's C1 (Critical) finding: as shipped, the headline
evilginx capture flow could not complete out of the box.
Why
Following the README landed a new user in a dead end:
demo-cookiephishlet pointed its upstream (proxy_hosts.domain) at thesame host as the lure, so evilginx dialed its own hostname and looped. No
session was ever captured.
ensure-destinationscaffolded a second phishlet whose landing host collidedwith
demo-cookie, so evilginx refused to load both.lsofonly and reported "did not bindHTTPS port 443 in time" even when evilginx was up and listening.
:443/:53with no unprivileged option and noteardown when a start failed.
make setupnever installedscreenorpexpect, so the firststart-luredied with
FileNotFoundError: 'screen'.How
demo-cookie.yamlnow proxies the lurehost
demo-cookie.local.phishkitto a distinct HTTPS upstreamapp.cookie-demo.test.demos/cookie/server.tsserves HTTPS whenTLS_CERT/TLS_KEYare set, andmake demo-cookie-tlsstands that upstream upwith a self-signed cert. evilginx proxies to it with verification off (goproxy
default), so a self-signed cert is fine for the dry-run.
configure_lure.pyprobes the configured HTTPS port with asocket connect (falling back to
ss/lsof), re-checks once after the processis confirmed up, and reads the port from the config instead of a hard-coded 443.
EVILGINX_HTTPS_PORT/EVILGINX_DNS_PORTlet thelure bind unprivileged high ports; the docs cover
setcap/sudo for the fullloop. No security default was weakened.
screensession and clears thehalf-bound port (both the Python launcher and
evilginx_ctl).ensure-destinationreuses an existing phishlet that alreadyserves the same landing host instead of writing a colliding duplicate.
upstream_domainnow handles single-label internal hosts and compoundpublic suffixes (
co.uk,github.io, and similar).make setupinstallspexpectinto a managedvenv/and checks forscreen.How it was verified
Run on a headless Debian box (no root). All green:
cargo fmt --check,cargo clippy -D warnings, andcargo test -p phishkit-core -p phishkit-cli --all-targets— 15 core + 5integration tests pass, including new tests for
upstream_domain(apex,single-label, compound suffixes), inline proxy-host parsing, and phishlet reuse.
python3 -m unittest discover -s tests/python— 16 tests covering portselection, the socket bind poll, config/port injection, and lure-path logic.
bash tests/smoke/demo_cookie_e2e.sh(make test-aitm) — stands up the HTTPSupstream and drives login →
Set-Cookie: session→ authenticated/dashboard.errors (
make validate-phishlet PHISHLET=demo-cookie).EVILGINX_HTTPS_PORT=8443and confirmed it binds127.0.0.1:8443while the new socket probe detects it — the oldlsof-onlyprobe returns nothing here (no
lsofinstalled), which is exactly the falsenegative this fixes.
Still needs root / manual
:443/:53and the upstream binds127.0.0.2:443, so it needs root orsetcapand/etc/hostsentries. Thatpath is scripted in
tests/smoke/aitm_e2e_sudo.sh(sudo bash ...) anddocumented in the walkthrough. CI runs the unprivileged surface test instead.
Files changed
Engine:
engagement.rs,destination.rs,evilginx_ctl.rs. Launcher:kit/evilginx/scripts/configure_lure.py. Demo:demos/cookie/server.ts,kit/evilginx/phishlets/demo-cookie.yaml,scripts/gen_demo_tls_cert.sh,Makefile. Tests:tests/python/test_configure_lure.py,tests/smoke/demo_cookie_e2e.sh,tests/smoke/aitm_e2e_sudo.sh, CI job. Docs:README.md,docs/guide/walkthrough.md,CHANGELOG.md.