Skip to content

Make the AiTM cookie demo path runnable end to end - #8

Closed
adamsiwiec1 wants to merge 1 commit into
mainfrom
fix/phishkit-aitm-demo-e2e
Closed

adamsiwiec1 wants to merge 1 commit into
mainfrom
fix/phishkit-aitm-demo-e2e

Conversation

@adamsiwiec1

Copy link
Copy Markdown
Contributor

What was wrong (C1)

The headline AiTM path did not complete out of the box:

  1. make setup never installed screen or pexpect, which configure_lure.py needs.
  2. evilginx needs :443 / :53 privileges with no documented setcap path.
  3. The bind probe used only lsof, which is often missing, and reported "did not bind HTTPS port 443" while evilginx was already LISTEN.
  4. demo-cookie.yaml set proxy_hosts, login, and auth_tokens all to demo-cookie.local.phishkit — the same host as the lure — so evilginx dialed itself and never captured a session.
  5. ensure-destination scaffolded a colliding demo-cookie-local-phishkit phishlet.
  6. upstream_domain stripped compound public suffixes to co.uk / github.io, which fed broken phishlet generation (M1).

Fix

  • Rewrite demo-cookie.yaml so upstream is cookie-origin.local.phishkit (distinct from the lure host).
  • Add make demo-cookie-https: HTTPS mock on 127.0.0.2:443 (same port, other IP, so it does not collide with evilginx on 127.0.0.1).
  • Bind probe: real TCP connect, then ss, then lsof, with FileNotFoundError handling, longer timeout, and a grace re-check.
  • make setup installs scripts/requirements.txt into venv and documents screen + setcap for :443/:53.
  • Reuse the shipped demo-cookie phishlet for demo hosts instead of scaffolding a colliding name.
  • upstream_domain understands common multi-part public suffixes (.co.uk, github.io, local.phishkit, …).

Defaults are not weakened: the HTTPS mock and privileged ports stay explicit operator steps.

Tests

Unit:

  • engagement::tests (including acme.co.uk, github.io, local.phishkit eTLD+1)
  • engagement::demo_phishlet_tests::demo_cookie_phishlet_does_not_self_proxy
  • destination::demo_reuse_tests::shipped_demo_cookie_hosts_reuse_demo_cookie_phishlet

Integration/smoke (committed script):

  • scripts/test-https-bind-probe.sh — free port / listening / late bind

Command run before pushing:

cargo test -p phishkit-core --lib
bash scripts/test-https-bind-probe.sh

Result: 10 rust passed; 3 bind-probe checks passed.

Full live evilginx capture on this shared box still needs setcap (or root) for :443 on both evilginx and the HTTPS mock; that is documented rather than silently skipped.

The shipped demo-cookie phishlet pointed proxy_hosts, login, and auth_tokens
all at demo-cookie.local.phishkit — the same host as the lure. evilginx dialed
itself, failed to clone the upstream cert, and never captured a session.
ensure-destination also scaffolded a colliding demo-cookie-local-phishkit
yaml. start-lure reported "did not bind HTTPS port 443" while evilginx was
already LISTEN, because the probe only used lsof (often missing). make setup
never installed screen or pexpect, which configure_lure needs.

This change:

- Rewrites demo-cookie.yaml so upstream is cookie-origin.local.phishkit
  (distinct from the lure host).
- Adds make demo-cookie-https: HTTPS mock on 127.0.0.2:443 (same port, other
  IP, so it does not collide with evilginx on 127.0.0.1).
- Fixes the bind probe to try a real TCP connect, then ss, then lsof, with
  FileNotFoundError handling and a longer timeout plus grace re-check.
- Extends make setup to install scripts/requirements.txt into venv and to
  document screen + setcap for :443/:53.
- Reuses the shipped demo-cookie phishlet for demo hosts instead of
  scaffolding a colliding name.
- Fixes upstream_domain for compound public suffixes (.co.uk, github.io,
  local.phishkit, …) so phishlet generation does not strip to co.uk.

Tests:
- engagement::tests (incl. co.uk / github.io / local.phishkit eTLD+1)
- engagement::demo_phishlet_tests::demo_cookie_phishlet_does_not_self_proxy
- destination::demo_reuse_tests::shipped_demo_cookie_hosts_reuse_demo_cookie_phishlet
- scripts/test-https-bind-probe.sh (free port / listening / late bind)

Run: cargo test -p phishkit-core --lib && bash scripts/test-https-bind-probe.sh
Result: 10 rust passed; 3 bind-probe checks passed.
@adamsiwiec1

Copy link
Copy Markdown
Contributor Author

Closing in favor of #9 (fix/aitm-demo-e2e).

#9 covers the same C1 ground with more complete wiring: CI job for the AiTM checks, Python unit tests for the bind poll and port selection, smoke scripts, TLS cert helper, walkthrough/README updates, and a CHANGELOG entry. I compared the two branches file-by-file; the only paths unique to this PR were demos/cookie/README.md and scripts/test-https-bind-probe.sh, and both are superseded by #9's docs plus tests/python/test_configure_lure.py / smoke scripts (with the demo hostnames #9 settled on: app.cookie-demo.test / make demo-cookie-tls).

Nothing unique from this PR needs to be folded into #9 before merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant