Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ jobs:
- run: npm ci
- run: npm run build

aitm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: demos/package-lock.json
- name: Python unit tests (evilginx lure launcher)
run: python3 -m unittest discover -s tests/python -v
- name: AiTM demo smoke test (HTTPS upstream + cookie capture surface)
run: bash tests/smoke/demo_cookie_e2e.sh

workflow-lint:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ Thumbs.db

# Rust workspace target (repo root)
/target/

# Local demo TLS certs (generated by make demo-cookie-tls)
demos/.certs/
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@ All notable changes to phishkit are documented here.
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- AiTM cookie demo now runs end to end. The `demo-cookie` phishlet proxies to a
reachable HTTPS upstream (`app.cookie-demo.test`) that is distinct from the lure
host, so evilginx no longer dials its own hostname and loops.
- The lure launcher's bind poll no longer reports a false negative. It probes the
configured HTTPS port with a socket connect (with `ss`/`lsof` as a fallback),
re-checks once after the process is confirmed up, and binds the port read from
the config instead of a hard-coded `443`.
- A failed lure start tears down its `screen` session and any half-bound port
instead of leaving them running.
- `ensure-destination` reuses an existing phishlet that already serves the same
landing host rather than scaffolding a duplicate that collides at load time.
- `upstream_domain` handles single-label internal hosts and compound public
suffixes (`co.uk`, `github.io`, and similar) instead of always stripping the
left label.

### Added

- `make demo-cookie-tls` — serves the cookie app as an HTTPS upstream for the
AiTM dry-run (self-signed cert under `demos/.certs/`).
- `EVILGINX_HTTPS_PORT` / `EVILGINX_DNS_PORT` — run the lure on unprivileged high
ports without root.
- `tests/python/` — unit tests for the lure launcher (port selection, bind poll,
config and lure-path logic).
- `tests/smoke/demo_cookie_e2e.sh` (`make test-aitm`) — unprivileged smoke test of
the HTTPS upstream and cookie capture surface.
- `tests/smoke/aitm_e2e_sudo.sh` — full proxy loop through evilginx for a lab box.
- CI job that runs the Python unit tests and the AiTM smoke test.

### Changed

- `make setup` installs `pexpect` into a managed `venv/` and checks for `screen`.
- [Walkthrough](docs/guide/walkthrough.md) documents the AiTM demo end to end.

## [0.1.0] - 2026-08-14

**Alpha.** First tagged cut — primitive, not a beta, not production. We are
Expand Down
50 changes: 45 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
build-evilginx build \
validate-phishlet evilginx-dryrun evilginx-prod evilginx-creds \
evilginx-start evilginx-stop \
demo demo-cookie demo-firebase demo-tunnel \
demo demo-cookie demo-cookie-tls demo-firebase demo-tunnel \
vendor community-phishlets desktop cli \
setup start check lint test test-unit test-integration test-integration-docker \
setup start check lint test test-unit test-python test-aitm \
test-integration test-integration-docker \
test-destinations docs docs-build \
campaign quick-test \
update-video-documentation update-video-documentation-desktop \
Expand All @@ -26,6 +27,7 @@ help:
@echo ""
@echo "Local demos (TypeScript practice apps):"
@echo " make demo-cookie Cookie-session mock on :9080"
@echo " make demo-cookie-tls Cookie app as HTTPS upstream (AiTM demo)"
@echo " make demo-firebase Firebase-shaped mock on :9081"
@echo " make demo Start both demos"
@echo " # see demos/ and demos/README.md"
Expand Down Expand Up @@ -73,6 +75,21 @@ help:
demo-cookie:
@(cd demos && npm install --silent && npm run demo:cookie)

# Serve the cookie app as an HTTPS *upstream* on a host distinct from the lure,
# so evilginx can proxy and capture a real session (audit C1.4). Pair with the
# demo-cookie phishlet. Defaults to 127.0.0.2:443 (needs root/setcap for :443);
# override HOST/PORT for an unprivileged run.
# TLS_HOST=127.0.0.2 TLS_PORT=443 make demo-cookie-tls
demo-cookie-tls:
@TLS_HOST="$${TLS_HOST:-127.0.0.2}"; TLS_PORT="$${TLS_PORT:-443}"; \
./scripts/gen_demo_tls_cert.sh demos/.certs app.cookie-demo.test; \
echo "demo-cookie HTTPS upstream → https://$$TLS_HOST:$$TLS_PORT (CN=app.cookie-demo.test)"; \
(cd demos && npm install --silent); \
cd demos && HOST="$$TLS_HOST" PORT="$$TLS_PORT" \
TLS_CERT="$(CURDIR)/demos/.certs/app.cookie-demo.test.crt" \
TLS_KEY="$(CURDIR)/demos/.certs/app.cookie-demo.test.key" \
npm run demo:cookie

demo-firebase:
@(cd demos && npm install --silent && npm run demo:firebase)

Expand Down Expand Up @@ -162,15 +179,38 @@ setup:
@export PATH="$$HOME/.cargo/bin:$$PATH"; \
command -v cargo >/dev/null || { echo "cargo not found. Install Rust: https://rustup.rs (then restart the shell)"; exit 1; }; \
echo "==> desktop dependencies"; (cd apps/desktop && npm install); \
echo "==> docs dependencies"; npm install
echo "==> docs dependencies"; npm install; \
echo "==> python deps for the evilginx lure (pexpect in a managed venv)"; \
if [ ! -x venv/bin/python ]; then python3 -m venv venv; fi; \
./venv/bin/python -m pip install -q -r scripts/requirements.txt; \
echo "==> screen (required to run evilginx with a real TTY)"; \
if command -v screen >/dev/null; then \
echo " screen: $$(command -v screen)"; \
elif command -v apt-get >/dev/null; then \
sudo apt-get install -y screen || echo " could not auto-install screen — install it manually"; \
elif command -v brew >/dev/null; then \
brew install screen || echo " could not auto-install screen — install it manually"; \
else \
echo " screen not found — install it (apt-get install screen / brew install screen)"; \
fi

# Run the supported desktop app.
start: desktop

# Fast quality gates for the native engine (mirrors CI).
check: test-unit
check: test-unit test-python

test: test-unit test-python

# Python unit tests for the evilginx lure launcher (stdlib unittest, no extra deps).
test-python:
@echo "==> python unit tests"; \
python3 -m unittest discover -s tests/python -v

test: test-unit
# Unprivileged AiTM smoke test: stands up the HTTPS upstream and drives the
# cookie login → session → dashboard flow (the capture surface evilginx proxies).
test-aitm:
@bash tests/smoke/demo_cookie_e2e.sh

test-unit:
@export PATH="$$HOME/.cargo/bin:$$PATH"; \
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,19 @@ make start # run the supported desktop app (tauri dev)
```

Requires git, Rust stable (`~/.cargo/bin` on `PATH`), Node (see `.nvmrc`), the Go
toolchain (to build evilginx once), and the Tauri prerequisites for your OS. Full
instructions, including platform support, are in the
toolchain (to build evilginx once), and the Tauri prerequisites for your OS. The
AiTM lure also needs `screen` and Python `pexpect`, which `make setup` installs
into a managed `venv/`. Full instructions, including platform support, are in the
[install guide](docs/guide/install.md).

To run the bundled AiTM capture end to end against the cookie demo, follow
[AiTM demo end to end](docs/guide/walkthrough.md#aitm-demo-end-to-end). A quick
unprivileged check of the capture surface:

```bash
make test-aitm # stands up the HTTPS upstream and drives the cookie login flow
```

The supported product is the desktop app under [`apps/desktop/`](apps/desktop/)
with the AiTM kit under [`kit/evilginx/`](kit/evilginx/).

Expand Down
29 changes: 28 additions & 1 deletion crates/phishkit-core/src/destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use serde_json::{json, Value};
use crate::assessment;
use crate::db::{self, Profile, UpsertProfile};
use crate::engagement::{
default_dryrun_domain, normalize_target_host, phishlet_name_for_target, upstream_domain,
default_dryrun_domain, find_reusable_phishlet, normalize_target_host, phishlet_name_for_target,
upstream_domain,
};
use crate::error::{AppError, AppResult};
use crate::kit::kit_root;
Expand Down Expand Up @@ -176,6 +177,32 @@ fn ensure_phishlet(
}
}

// Reuse an existing phishlet that already serves this landing host instead of
// scaffolding a duplicate. Two enabled phishlets with the same landing host make
// evilginx refuse to load with a "hostname collision" error (audit C1.5).
let phishlets_dir = root.join("kit/evilginx/phishlets");
if let Some(existing) = find_reusable_phishlet(&phishlets_dir, &host, &name) {
let existing_path = phishlets_dir.join(format!("{existing}.yaml"));
let mut info = stack_info.clone();
if info.login_path.is_none() {
info.login_path = Some("/login".into());
}
return Ok(GenerateResult {
ok: true,
phishlet: existing.clone(),
dryrun_domain: default_dryrun_domain(&host),
target_domain: host.clone(),
upstream_domain: upstream_domain(&host),
stack_info: info,
path: existing_path.display().to_string(),
created: false,
message: format!(
"Reusing existing phishlet '{existing}' (same landing host as '{host}') \
to avoid an evilginx hostname collision"
),
});
}

if stack == "firebase" {
let templates = phishlet::list_pattern_templates()?;
if templates.iter().any(|t| t.id == "firebase") {
Expand Down
Loading
Loading