How professional adversary simulation operates against web applications — initial access via phishing, persistence inside accounts, lateral movement through connected systems.
Pentests find specific bugs in scope. Red teams simulate full adversaries — phishing users, evading detection, establishing persistence, achieving specific business-impact objectives. The goal isn't a long bug list; it's understanding whether your security operations actually detect and respond to a sophisticated adversary.
This tutorial walks through how a web-app-focused red team operates, with defensive takeaways at each stage.
Beyond technical recon (tutorial 7), the human reconnaissance:
Effective phishing pretexts are specific. Examples successfully used:
The more specific to the target's actual context, the higher the success rate. Spear phishing at this level returns 30-70% click rates in unprepared environments.
For modern targets, the most common initial vectors:
Email sends user to a fake login page (perfect clone of real). User enters credentials and MFA code. Attacker forwards in real-time to real login page, completes auth, captures session cookie.
Modern tooling: Evilginx2, Modlishka. Transparent reverse-proxy attack frameworks. Bypass TOTP MFA almost trivially.
Email links to a real OAuth authorize URL for an app the attacker registered. User authenticates with their real provider (Google, Microsoft), grants consent. Attacker now has a long-lived access token.
Username from one breach + password from another breach matches your user. No phishing needed.
User browses to attacker-controlled page. Browser exploit or malware grabs cookies (no MFA needed since the session is already authenticated).
Once an account is compromised, attackers want to maintain access even if the password is changed or session is revoked.
Attacker adds their own TOTP enrollment to the account. Even if the user resets their password, attacker still passes MFA.
Defense: notify on MFA changes, require step-up auth for MFA modifications, periodic audit of registered MFA methods.
Attacker sets their own email as a recovery option. If user does full account reset, recovery email is the bypass.
Defense: require recent password verification to add recovery options, notify on changes.
Attacker authorizes their own OAuth app with broad scopes. Long-lived token, not affected by password change.
Defense: admin approval for OAuth apps, periodic review of authorized apps per user, scope minimization.
If the user has a developer account, attacker generates a personal access token with broad scopes. Doesn't expire with password change.
Defense: API key expiration, scope minimization, audit of issued tokens, anomaly detection on API usage.
If the app supports webhooks, integrations, third-party connections: attacker establishes a backdoor connection that delivers events to attacker infrastructure.
Defense: audit of integrations, approval workflows for new integrations, periodic verification of integration endpoints.
Once persisted as a low-privilege user, attackers escalate.
User has more permissions than their job requires (overprovisioned access). Attacker exploits the excess.
Defense: principle of least privilege, periodic access reviews, just-in-time elevation.
The compromised user can access features that elevate. "Edit my profile" forms that accept role parameters. Internal APIs without authorization checks.
Defense: server-side authorization on every endpoint, not just client-side UI hiding.
Compromised internal account asks help desk for "my password reset" or "my MFA reset." Help desk obliges. Now attacker has more permanent access.
Defense: out-of-band verification for credential/MFA changes, never reset based solely on "I'm locked out" requests.
Low-privilege OAuth token used to authorize a higher-privilege app in the same flow.
Defense: explicit re-authentication for elevated scopes, scope auditing.
Modern SaaS environments interconnect. Compromise of one often pivots to others.
Attacker has access to your SSO provider's session. Now logged into Slack, Google Workspace, GitHub, AWS console, etc., all via the SSO.
Defense: separate, stronger auth for high-stakes services (AWS console requires additional MFA even after SSO), audit logs cross-correlated.
Developer account compromised. Attacker pushes code to a branch, opens PR, exploits CI/CD permissions to deploy malicious code or steal secrets from build environment.
Defense: required code review (no bypass), production deploy approval workflows, ephemeral CI credentials, secret scanning in repos and builds.
Application compromise → instance metadata service → IAM role credentials → cloud account access. (Covered in tutorial 5.)
Defense: scoped IAM roles, IMDSv2 mandatory, network segmentation between app and metadata service.
Compromise of an account that has vendor admin access. Attacker uses your access to your vendor (a SaaS you bought, a service you use) to attack the vendor's other customers, or to harvest data passing through.
Defense: scoped permissions on vendor accounts, audit of cross-account access, vendor SOC 2 review.
Whatever the actual goal:
If you didn't detect earlier, this is your last chance. Indicators:
Centralized logging + anomaly detection finds these — if you're looking.
After a red team engagement, the failures cluster into categories:
Missing telemetry. The attack happened, but you can't see it because logging wasn't enabled for that path.
Alert fatigue, no on-call rotation, alerts going to dead email distribution lists.
Triage failed. The first responder dismissed it as noise.
No documented response, no clear authority, conflicting decisions.
Outdated procedures, missing escalation contacts, broken assumptions.
Each is fixable, but only if you've tested. Red team exercises reveal which category you fall into. Then you fix the broken layer and test again.
Stacking the controls from this tutorial against the full attack chain:
| Stage | Best defense |
|---|---|
| OSINT | Periodic external recon against self |
| Phishing | Phishing-resistant MFA + employee training |
| Initial access | MFA, conditional access, session hardening |
| Persistence | MFA change notifications, OAuth review, API key audit |
| Privilege escalation | Least privilege, application-layer auth checks |
| Lateral movement | Network segmentation, separate auth for high-stakes |
| Action | Detection at every previous stage |
No single layer stops everything. Combined, they create choke points that slow attackers and give detection time to fire.
Red team exercises are expensive (€30K-€200K+ for serious engagements) and embarrassing (they will find things). They're also the only realistic test of your operational security.
Don't engage one before you've done the basics. They'll waste their time and yours finding obvious bugs that internal audits should catch. Engage when you've done the work and want to see if it's actually enough.
Tutorial 10 covers what to do when the red team — or a real attacker — succeeds.