@aegis-scan/skills 0.5.0 → 0.5.2

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.
Files changed (345) hide show
  1. package/ATTRIBUTION.md +93 -0
  2. package/package.json +1 -1
  3. package/sbom.cdx.json +1 -0
  4. package/skills/compliance/aegis-native/brutaler-anwalt/.claude-plugin/plugin.json +108 -0
  5. package/skills/compliance/aegis-native/brutaler-anwalt/CHANGELOG.md +878 -0
  6. package/skills/compliance/aegis-native/brutaler-anwalt/README.md +9 -3
  7. package/skills/compliance/aegis-native/brutaler-anwalt/SKILL.md +93 -14
  8. package/skills/compliance/aegis-native/brutaler-anwalt/commands/audit.md +193 -0
  9. package/skills/compliance/aegis-native/brutaler-anwalt/commands/avv-redline.md +246 -0
  10. package/skills/compliance/aegis-native/brutaler-anwalt/commands/az-verify.md +155 -0
  11. package/skills/compliance/aegis-native/brutaler-anwalt/commands/cold-start.md +157 -0
  12. package/skills/compliance/aegis-native/brutaler-anwalt/commands/dsar-respond.md +180 -0
  13. package/skills/compliance/aegis-native/brutaler-anwalt/commands/health.md +50 -0
  14. package/skills/compliance/aegis-native/brutaler-anwalt/commands/simulate.md +158 -0
  15. package/skills/compliance/aegis-native/brutaler-anwalt/hooks/post_write.py +315 -0
  16. package/skills/compliance/aegis-native/brutaler-anwalt/hooks/prompt_submit.py +144 -0
  17. package/skills/compliance/aegis-native/brutaler-anwalt/hooks/session_start.py +57 -0
  18. package/skills/compliance/aegis-native/brutaler-anwalt/hooks/triggers.json +191 -0
  19. package/skills/compliance/aegis-native/brutaler-anwalt/references/INDEX.md +102 -0
  20. package/skills/compliance/aegis-native/brutaler-anwalt/references/abmahn-templates.md +1 -1
  21. package/skills/compliance/aegis-native/brutaler-anwalt/references/aegis-integration.md +60 -5
  22. package/skills/compliance/aegis-native/brutaler-anwalt/references/audit-patterns.md +745 -11
  23. package/skills/compliance/aegis-native/brutaler-anwalt/references/az-auffuellung-batch1.md +468 -0
  24. package/skills/compliance/aegis-native/brutaler-anwalt/references/bgh-urteile.md +106 -30
  25. package/skills/compliance/aegis-native/brutaler-anwalt/references/branchenrecht.md +247 -2
  26. package/skills/compliance/aegis-native/brutaler-anwalt/references/checklisten.md +75 -2
  27. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-aufsichtsbehoerden-taetigkeitsberichte-2024.md +310 -0
  28. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-bussgeld-argumentations-layer.md +598 -0
  29. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-dsk-beschluesse.md +346 -0
  30. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AGG/audit-relevance.md +76 -0
  31. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AGG/paragraphs.md +115 -0
  32. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AMG/audit-relevance.md +58 -0
  33. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/AMG/paragraphs.md +95 -0
  34. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ArbZG/audit-relevance.md +60 -0
  35. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ArbZG/paragraphs.md +90 -0
  36. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/BetrVG/audit-relevance.md +73 -0
  37. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/BetrVG/paragraphs.md +114 -0
  38. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DDG/audit-relevance.md +72 -0
  39. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DDG/paragraphs.md +103 -0
  40. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DiGAV/audit-relevance.md +65 -0
  41. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/DiGAV/paragraphs.md +102 -0
  42. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ElektroG/audit-relevance.md +66 -0
  43. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ElektroG/paragraphs.md +108 -0
  44. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/FernUSG/audit-relevance.md +80 -0
  45. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/FernUSG/paragraphs.md +102 -0
  46. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GeschGehG/audit-relevance.md +89 -0
  47. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GeschGehG/paragraphs.md +107 -0
  48. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GwG/audit-relevance.md +62 -0
  49. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/GwG/paragraphs.md +119 -0
  50. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HWG/audit-relevance.md +70 -0
  51. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HWG/paragraphs.md +125 -0
  52. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HinSchG/audit-relevance.md +70 -0
  53. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/HinSchG/paragraphs.md +116 -0
  54. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/INDEX.md +152 -0
  55. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/KWG/audit-relevance.md +64 -0
  56. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/KWG/paragraphs.md +110 -0
  57. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/LFGB/audit-relevance.md +63 -0
  58. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/LFGB/paragraphs.md +90 -0
  59. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/MPDG/audit-relevance.md +61 -0
  60. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/MPDG/paragraphs.md +96 -0
  61. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/NachwG/audit-relevance.md +54 -0
  62. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/NachwG/paragraphs.md +82 -0
  63. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/PAngV/audit-relevance.md +76 -0
  64. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/PAngV/paragraphs.md +86 -0
  65. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/RDG/audit-relevance.md +84 -0
  66. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/RDG/paragraphs.md +114 -0
  67. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/TDDDG/audit-relevance.md +92 -0
  68. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/TDDDG/paragraphs.md +91 -0
  69. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/UrhG-UrhDaG/audit-relevance.md +85 -0
  70. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/UrhG-UrhDaG/paragraphs.md +166 -0
  71. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VDuG/audit-relevance.md +71 -0
  72. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VDuG/paragraphs.md +102 -0
  73. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VERIFICATION-NOTES.md +111 -0
  74. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VVG/audit-relevance.md +65 -0
  75. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VVG/paragraphs.md +101 -0
  76. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VerpackG/audit-relevance.md +62 -0
  77. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/VerpackG/paragraphs.md +120 -0
  78. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/WpHG/audit-relevance.md +64 -0
  79. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/WpHG/paragraphs.md +120 -0
  80. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ZAG/audit-relevance.md +68 -0
  81. package/skills/compliance/aegis-native/brutaler-anwalt/references/de-statute-tier1/ZAG/paragraphs.md +110 -0
  82. package/skills/compliance/aegis-native/brutaler-anwalt/references/dsgvo.md +55 -8
  83. package/skills/compliance/aegis-native/brutaler-anwalt/references/eu-edpb-guidelines.md +505 -0
  84. package/skills/compliance/aegis-native/brutaler-anwalt/references/eu-eugh-dsgvo-schadensersatz.md +223 -0
  85. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BDSG/audit-relevance.md +31 -0
  86. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BFSG/audit-relevance.md +39 -0
  87. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BGB/audit-relevance.md +42 -0
  88. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DDG/audit-relevance.md +28 -0
  89. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DSGVO/audit-relevance.md +35 -0
  90. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/articles.md +4 -1
  91. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/audit-relevance.md +139 -0
  92. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/gpai-pflichten.md +102 -0
  93. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/hochrisiko-annex-iii.md +134 -0
  94. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/sanktionen-art-99.md +97 -0
  95. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/transparenz-art-50.md +120 -0
  96. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/uebergangsfristen.md +109 -0
  97. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CER-2022-2557/articles.md +42 -0
  98. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CRA-2024-2847/articles.md +87 -0
  99. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CSDDD-2024-1760/articles.md +43 -0
  100. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/CSRD-2022-2464/articles.md +42 -0
  101. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DGA-2022-868/articles.md +53 -0
  102. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DMA-2022-1925/articles.md +55 -0
  103. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DORA-2022-2554/articles.md +164 -0
  104. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DORA-2022-2554/audit-relevance.md +86 -0
  105. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/articles.md +3 -0
  106. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/audit-relevance.md +110 -0
  107. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/notice-and-action.md +138 -0
  108. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/small-platform-pflichten.md +109 -0
  109. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/trusted-flaggers.md +77 -0
  110. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/vlop-vlose.md +130 -0
  111. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/Data-Act-2023-2854/articles.md +102 -0
  112. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/Data-Act-2023-2854/audit-relevance.md +77 -0
  113. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/MiCA-2023-1114/articles.md +124 -0
  114. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/MiCA-2023-1114/audit-relevance.md +85 -0
  115. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/NIS2-2022-2555/articles.md +101 -0
  116. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/ProdHaftRL-2024-2853/articles.md +68 -0
  117. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/eIDAS-2024-1183/articles.md +43 -0
  118. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/KWG.md +52 -0
  119. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/PSD2.md +67 -0
  120. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/Finance/ZAG.md +50 -0
  121. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/GlueStV/articles.md +86 -0
  122. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HGB-AO/audit-relevance.md +27 -0
  123. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HinSchG/articles.md +96 -0
  124. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/JuSchG-JMStV/articles.md +86 -0
  125. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/KritisDachG/articles.md +39 -0
  126. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/LkSG/articles.md +90 -0
  127. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/DiGAV.md +60 -0
  128. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/IVDR-2017-746.md +51 -0
  129. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/MedTech/MDR-2017-745.md +85 -0
  130. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/NIS2UmsuCG-BSIG/articles.md +53 -0
  131. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/StGB/relevante-paragraphen.md +157 -0
  132. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TDDDG/audit-relevance.md +33 -0
  133. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TDDDG/paragraphs.md +3 -2
  134. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TKG/articles.md +73 -0
  135. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/UWG/audit-relevance.md +39 -0
  136. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/UWG/paragraphs.md +71 -3
  137. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VERIFICATION-STATUS.md +266 -0
  138. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VSBG/audit-relevance.md +37 -0
  139. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/ePrivacy-RL-2002-58/articles.md +92 -0
  140. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/ePrivacy-RL-2002-58/audit-relevance.md +62 -0
  141. package/skills/compliance/aegis-native/brutaler-anwalt/references/it-recht.md +115 -9
  142. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/INDEX.md +1 -1
  143. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/anthropic-dpa.md +87 -0
  144. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/cookie-banner-pattern.md +202 -0
  145. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/dse-section-pattern.md +198 -0
  146. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/astro/tracking-server-endpoint.md +193 -0
  147. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/auth0-tom.md +92 -0
  148. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/clerk-tom.md +84 -0
  149. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/auth-cookies-pattern.md +295 -0
  150. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/cookie-banner-pattern.md +318 -0
  151. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/django/gdpr-cleanup-celery.md +339 -0
  152. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/cookie-banner-pattern.md +237 -0
  153. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/gdpr-routes-pattern.md +256 -0
  154. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/express/helmet-csp-pattern.md +207 -0
  155. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/agb-versioning-pattern.md +305 -0
  156. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/cookie-banner-pattern.md +287 -0
  157. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/gdpr-models-pattern.md +290 -0
  158. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/laravel/tracking-config-pattern.md +263 -0
  159. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/auth-pattern.md +265 -0
  160. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/cookie-banner-pattern.md +255 -0
  161. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/gdpr-cleanup-cron.md +244 -0
  162. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nest/tracking-interceptor.md +239 -0
  163. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/api-route-bearer-auth.md +103 -0
  164. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/dynamic-rendering-headers.md +83 -0
  165. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/env-driven-tracking.md +135 -0
  166. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/cookie-banner-pattern.md +294 -0
  167. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/devise-dsgvo-pattern.md +262 -0
  168. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/rails/gdpr-anonymization-pattern.md +283 -0
  169. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/react/consent-gate-pattern.md +99 -0
  170. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/react/cookie-banner-pattern.md +204 -0
  171. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/strapi/cms-pii-pattern.md +301 -0
  172. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/strapi/notice-and-action-plugin.md +371 -0
  173. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/cookie-banner-pattern.md +234 -0
  174. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/dse-section-pattern.md +231 -0
  175. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/svelte/sveltekit-server-hooks-pattern.md +217 -0
  176. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/google-analytics-consent.md +129 -0
  177. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/posthog-consent.md +79 -0
  178. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/cookie-banner-pattern.md +208 -0
  179. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/dse-i18n-pattern.md +204 -0
  180. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/nuxt-vs-vue-only-pattern.md +197 -0
  181. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/vue/tracking-pinia-pattern.md +211 -0
  182. package/skills/compliance/aegis-native/brutaler-anwalt/references/strafrecht-steuer.md +1 -1
  183. package/skills/compliance/aegis-native/brutaler-anwalt/references/streitwerte.json +176 -0
  184. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/DSFA-template.md +80 -0
  185. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/VVT-template-file-upload.md +98 -0
  186. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-EN-international.md +267 -0
  187. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-Audit-Klausel-Varianten.md +148 -0
  188. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-CH-revDSG.md +127 -0
  189. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-SCC-module2-controller-processor.md +180 -0
  190. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-SCC-module3-processor-subprocessor.md +144 -0
  191. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-Sub-Processor-List.md +114 -0
  192. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-TOMs.md +197 -0
  193. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-anhang-UK-IDTA.md +131 -0
  194. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/AVV-standard-DE.md +288 -0
  195. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates-avv-layer/Joint-Controller-Vertrag-Art-26.md +265 -0
  196. package/skills/compliance/aegis-native/brutaler-anwalt/scripts/health-check.sh +190 -48
  197. package/skills/compliance/aegis-native/brutaler-anwalt/scripts/test-triggers.sh +145 -0
  198. package/skills/compliance/aegis-native/brutaler-anwalt/settings.json +90 -0
  199. package/skills/defensive/permoon-fork/README.md +40 -0
  200. package/skills/defensive/permoon-fork/multi-model-consolidation/SKILL.md +47 -0
  201. package/skills/defensive/permoon-fork/multi-model-severity/SKILL.md +34 -0
  202. package/skills/defensive/permoon-fork/multi-model-system-prompt/SKILL.md +40 -0
  203. package/skills/foundation/aegis-native/aegis-handover-writer/SKILL.md +1 -1
  204. package/skills/foundation/aegis-native/aegis-quality-gates/SKILL.md +1 -1
  205. package/skills/offensive/airecon-fork/ctf-crypto/SKILL.md +260 -0
  206. package/skills/offensive/airecon-fork/ctf-crypto-modern-ciphers/SKILL.md +688 -0
  207. package/skills/offensive/airecon-fork/ctf-forensics/SKILL.md +253 -0
  208. package/skills/offensive/airecon-fork/ctf-forensics-network/SKILL.md +480 -0
  209. package/skills/offensive/airecon-fork/ctf-heap-advanced/SKILL.md +336 -0
  210. package/skills/offensive/airecon-fork/ctf-pwn/SKILL.md +294 -0
  211. package/skills/offensive/airecon-fork/ctf-pwn-rop-and-shellcode/SKILL.md +392 -0
  212. package/skills/offensive/airecon-fork/ctf-reversing/SKILL.md +284 -0
  213. package/skills/offensive/airecon-fork/frameworks-django/SKILL.md +268 -0
  214. package/skills/offensive/airecon-fork/frameworks-dotnet/SKILL.md +280 -0
  215. package/skills/offensive/airecon-fork/frameworks-express/SKILL.md +266 -0
  216. package/skills/offensive/airecon-fork/frameworks-fastapi/SKILL.md +193 -0
  217. package/skills/offensive/airecon-fork/frameworks-flask/SKILL.md +297 -0
  218. package/skills/offensive/airecon-fork/frameworks-laravel/SKILL.md +260 -0
  219. package/skills/offensive/airecon-fork/frameworks-nextjs/SKILL.md +230 -0
  220. package/skills/offensive/airecon-fork/frameworks-php/SKILL.md +271 -0
  221. package/skills/offensive/airecon-fork/frameworks-rails/SKILL.md +269 -0
  222. package/skills/offensive/airecon-fork/frameworks-spring/SKILL.md +245 -0
  223. package/skills/offensive/airecon-fork/frameworks-wordpress/SKILL.md +348 -0
  224. package/skills/offensive/airecon-fork/payloads-command-injection/SKILL.md +459 -0
  225. package/skills/offensive/airecon-fork/payloads-http-parameter-pollution/SKILL.md +129 -0
  226. package/skills/offensive/airecon-fork/payloads-ldap-injection/SKILL.md +100 -0
  227. package/skills/offensive/airecon-fork/payloads-lfi/SKILL.md +485 -0
  228. package/skills/offensive/airecon-fork/payloads-sqli/SKILL.md +419 -0
  229. package/skills/offensive/airecon-fork/payloads-ssrf/SKILL.md +125 -0
  230. package/skills/offensive/airecon-fork/payloads-ssti/SKILL.md +443 -0
  231. package/skills/offensive/airecon-fork/payloads-xss/SKILL.md +447 -0
  232. package/skills/offensive/airecon-fork/payloads-xxe/SKILL.md +172 -0
  233. package/skills/offensive/airecon-fork/postexploit-ad-credential-attacks/SKILL.md +306 -0
  234. package/skills/offensive/airecon-fork/postexploit-container-escape/SKILL.md +299 -0
  235. package/skills/offensive/airecon-fork/postexploit-credential-dumping/SKILL.md +249 -0
  236. package/skills/offensive/airecon-fork/postexploit-lateral-movement/SKILL.md +194 -0
  237. package/skills/offensive/airecon-fork/postexploit-linux-privesc/SKILL.md +252 -0
  238. package/skills/offensive/airecon-fork/postexploit-netexec-workflow/SKILL.md +302 -0
  239. package/skills/offensive/airecon-fork/postexploit-pivoting/SKILL.md +205 -0
  240. package/skills/offensive/airecon-fork/postexploit-windows-privesc/SKILL.md +210 -0
  241. package/skills/offensive/airecon-fork/protocols-active-directory/SKILL.md +314 -0
  242. package/skills/offensive/airecon-fork/protocols-dns/SKILL.md +203 -0
  243. package/skills/offensive/airecon-fork/protocols-ftp/SKILL.md +159 -0
  244. package/skills/offensive/airecon-fork/protocols-graphql/SKILL.md +648 -0
  245. package/skills/offensive/airecon-fork/protocols-kerberos/SKILL.md +168 -0
  246. package/skills/offensive/airecon-fork/protocols-ldap/SKILL.md +245 -0
  247. package/skills/offensive/airecon-fork/protocols-rdp/SKILL.md +186 -0
  248. package/skills/offensive/airecon-fork/protocols-smb/SKILL.md +191 -0
  249. package/skills/offensive/airecon-fork/protocols-smtp-imap/SKILL.md +263 -0
  250. package/skills/offensive/airecon-fork/protocols-snmp/SKILL.md +147 -0
  251. package/skills/offensive/airecon-fork/protocols-ssh/SKILL.md +287 -0
  252. package/skills/offensive/airecon-fork/reconnaissance-asn-whois-osint/SKILL.md +236 -0
  253. package/skills/offensive/airecon-fork/reconnaissance-ctf-methodology/SKILL.md +435 -0
  254. package/skills/offensive/airecon-fork/reconnaissance-dorking/SKILL.md +182 -0
  255. package/skills/offensive/airecon-fork/reconnaissance-exposed-devtools-detection/SKILL.md +513 -0
  256. package/skills/offensive/airecon-fork/reconnaissance-full-recon/SKILL.md +305 -0
  257. package/skills/offensive/airecon-fork/reconnaissance-internal-pentest/SKILL.md +202 -0
  258. package/skills/offensive/airecon-fork/reconnaissance-javascript-analysis/SKILL.md +167 -0
  259. package/skills/offensive/airecon-fork/reconnaissance-js-internal-hostname-intelligence/SKILL.md +391 -0
  260. package/skills/offensive/airecon-fork/reconnaissance-monitoring-secrets-exposure/SKILL.md +394 -0
  261. package/skills/offensive/airecon-fork/reconnaissance-shodan-censys/SKILL.md +279 -0
  262. package/skills/offensive/airecon-fork/reconnaissance-subdomain-enum/SKILL.md +952 -0
  263. package/skills/offensive/airecon-fork/technologies-cicd-attacks/SKILL.md +283 -0
  264. package/skills/offensive/airecon-fork/technologies-cloud-security/SKILL.md +299 -0
  265. package/skills/offensive/airecon-fork/technologies-docker-container/SKILL.md +266 -0
  266. package/skills/offensive/airecon-fork/technologies-elasticsearch/SKILL.md +226 -0
  267. package/skills/offensive/airecon-fork/technologies-firebase-firestore/SKILL.md +213 -0
  268. package/skills/offensive/airecon-fork/technologies-frida-hooking/SKILL.md +387 -0
  269. package/skills/offensive/airecon-fork/technologies-gitlab-github/SKILL.md +259 -0
  270. package/skills/offensive/airecon-fork/technologies-jenkins/SKILL.md +256 -0
  271. package/skills/offensive/airecon-fork/technologies-kubernetes-pentest/SKILL.md +281 -0
  272. package/skills/offensive/airecon-fork/technologies-memcached/SKILL.md +230 -0
  273. package/skills/offensive/airecon-fork/technologies-mobile-app-pentesting/SKILL.md +105 -0
  274. package/skills/offensive/airecon-fork/technologies-mongodb/SKILL.md +257 -0
  275. package/skills/offensive/airecon-fork/technologies-nginx-apache/SKILL.md +280 -0
  276. package/skills/offensive/airecon-fork/technologies-observability-stack-attacks/SKILL.md +501 -0
  277. package/skills/offensive/airecon-fork/technologies-redis/SKILL.md +236 -0
  278. package/skills/offensive/airecon-fork/technologies-supabase/SKILL.md +270 -0
  279. package/skills/offensive/airecon-fork/technologies-tomcat/SKILL.md +232 -0
  280. package/skills/offensive/airecon-fork/tools-advanced-fuzzing/SKILL.md +351 -0
  281. package/skills/offensive/airecon-fork/tools-browser-automation/SKILL.md +300 -0
  282. package/skills/offensive/airecon-fork/tools-caido/SKILL.md +776 -0
  283. package/skills/offensive/airecon-fork/tools-code-review/SKILL.md +71 -0
  284. package/skills/offensive/airecon-fork/tools-dalfox/SKILL.md +189 -0
  285. package/skills/offensive/airecon-fork/tools-hashcat-john/SKILL.md +258 -0
  286. package/skills/offensive/airecon-fork/tools-impacket/SKILL.md +227 -0
  287. package/skills/offensive/airecon-fork/tools-install/SKILL.md +202 -0
  288. package/skills/offensive/airecon-fork/tools-metasploit/SKILL.md +270 -0
  289. package/skills/offensive/airecon-fork/tools-nmap/SKILL.md +211 -0
  290. package/skills/offensive/airecon-fork/tools-nuclei/SKILL.md +175 -0
  291. package/skills/offensive/airecon-fork/tools-reporting/SKILL.md +47 -0
  292. package/skills/offensive/airecon-fork/tools-scripting/SKILL.md +1939 -0
  293. package/skills/offensive/airecon-fork/tools-semgrep/SKILL.md +202 -0
  294. package/skills/offensive/airecon-fork/tools-source-audit/SKILL.md +308 -0
  295. package/skills/offensive/airecon-fork/tools-sqlmap/SKILL.md +137 -0
  296. package/skills/offensive/airecon-fork/tools-tool-catalog/SKILL.md +320 -0
  297. package/skills/offensive/airecon-fork/tools-wapiti/SKILL.md +293 -0
  298. package/skills/offensive/airecon-fork/vulnerabilities-2fa-bypass/SKILL.md +219 -0
  299. package/skills/offensive/airecon-fork/vulnerabilities-account-takeover/SKILL.md +223 -0
  300. package/skills/offensive/airecon-fork/vulnerabilities-api-schema-exposure/SKILL.md +849 -0
  301. package/skills/offensive/airecon-fork/vulnerabilities-api-testing/SKILL.md +278 -0
  302. package/skills/offensive/airecon-fork/vulnerabilities-auth-workflow/SKILL.md +252 -0
  303. package/skills/offensive/airecon-fork/vulnerabilities-authentication-jwt/SKILL.md +158 -0
  304. package/skills/offensive/airecon-fork/vulnerabilities-bfla/SKILL.md +156 -0
  305. package/skills/offensive/airecon-fork/vulnerabilities-blind-xss/SKILL.md +111 -0
  306. package/skills/offensive/airecon-fork/vulnerabilities-business-logic/SKILL.md +313 -0
  307. package/skills/offensive/airecon-fork/vulnerabilities-cors/SKILL.md +242 -0
  308. package/skills/offensive/airecon-fork/vulnerabilities-crlf-injection/SKILL.md +146 -0
  309. package/skills/offensive/airecon-fork/vulnerabilities-csrf/SKILL.md +200 -0
  310. package/skills/offensive/airecon-fork/vulnerabilities-csrf-advanced-bypass/SKILL.md +536 -0
  311. package/skills/offensive/airecon-fork/vulnerabilities-deserialization/SKILL.md +363 -0
  312. package/skills/offensive/airecon-fork/vulnerabilities-dom-based-vulnerabilities/SKILL.md +105 -0
  313. package/skills/offensive/airecon-fork/vulnerabilities-exploitation/SKILL.md +286 -0
  314. package/skills/offensive/airecon-fork/vulnerabilities-grpc/SKILL.md +123 -0
  315. package/skills/offensive/airecon-fork/vulnerabilities-host-header-injection/SKILL.md +169 -0
  316. package/skills/offensive/airecon-fork/vulnerabilities-http-smuggling/SKILL.md +411 -0
  317. package/skills/offensive/airecon-fork/vulnerabilities-idor/SKILL.md +705 -0
  318. package/skills/offensive/airecon-fork/vulnerabilities-information-disclosure/SKILL.md +867 -0
  319. package/skills/offensive/airecon-fork/vulnerabilities-insecure-file-uploads/SKILL.md +190 -0
  320. package/skills/offensive/airecon-fork/vulnerabilities-jwt-attacks/SKILL.md +270 -0
  321. package/skills/offensive/airecon-fork/vulnerabilities-kubernetes/SKILL.md +252 -0
  322. package/skills/offensive/airecon-fork/vulnerabilities-mass-assignment/SKILL.md +788 -0
  323. package/skills/offensive/airecon-fork/vulnerabilities-nosql-injection/SKILL.md +204 -0
  324. package/skills/offensive/airecon-fork/vulnerabilities-oauth-misconfig/SKILL.md +220 -0
  325. package/skills/offensive/airecon-fork/vulnerabilities-oauth-saml/SKILL.md +163 -0
  326. package/skills/offensive/airecon-fork/vulnerabilities-open-redirect/SKILL.md +167 -0
  327. package/skills/offensive/airecon-fork/vulnerabilities-password-reset-poisoning/SKILL.md +66 -0
  328. package/skills/offensive/airecon-fork/vulnerabilities-path-traversal/SKILL.md +192 -0
  329. package/skills/offensive/airecon-fork/vulnerabilities-privilege-escalation/SKILL.md +320 -0
  330. package/skills/offensive/airecon-fork/vulnerabilities-prototype-pollution/SKILL.md +242 -0
  331. package/skills/offensive/airecon-fork/vulnerabilities-race-conditions/SKILL.md +192 -0
  332. package/skills/offensive/airecon-fork/vulnerabilities-rce/SKILL.md +240 -0
  333. package/skills/offensive/airecon-fork/vulnerabilities-sensitive-file-pii-exposure/SKILL.md +589 -0
  334. package/skills/offensive/airecon-fork/vulnerabilities-spring4shell/SKILL.md +86 -0
  335. package/skills/offensive/airecon-fork/vulnerabilities-sql-injection/SKILL.md +313 -0
  336. package/skills/offensive/airecon-fork/vulnerabilities-ssrf/SKILL.md +183 -0
  337. package/skills/offensive/airecon-fork/vulnerabilities-ssti/SKILL.md +344 -0
  338. package/skills/offensive/airecon-fork/vulnerabilities-subdomain-takeover/SKILL.md +160 -0
  339. package/skills/offensive/airecon-fork/vulnerabilities-supply-chain/SKILL.md +125 -0
  340. package/skills/offensive/airecon-fork/vulnerabilities-unhandled-exception-differential/SKILL.md +742 -0
  341. package/skills/offensive/airecon-fork/vulnerabilities-waf-detection/SKILL.md +90 -0
  342. package/skills/offensive/airecon-fork/vulnerabilities-web-cache-poisoning/SKILL.md +233 -0
  343. package/skills/offensive/airecon-fork/vulnerabilities-websocket/SKILL.md +180 -0
  344. package/skills/offensive/airecon-fork/vulnerabilities-xss/SKILL.md +316 -0
  345. package/skills/offensive/airecon-fork/vulnerabilities-xxe/SKILL.md +222 -0
@@ -0,0 +1,688 @@
1
+ <!-- aegis-local: forked 2026-05-04 from pikpikcu/airecon@9a21453459d87eefb012ea355c79b593d0d3c0cc (MIT-licensed); attribution preserved, see ATTRIBUTION.md -->
2
+
3
+ # CTF Crypto - Modern Cipher Attacks
4
+
5
+ ## Table of Contents
6
+ - [AES-CFB-8 Static IV State Forging](#aes-cfb-8-static-iv-state-forging)
7
+ - [ECB Pattern Leakage on Images](#ecb-pattern-leakage-on-images)
8
+ - [Padding Oracle Attack](#padding-oracle-attack)
9
+ - [CBC-MAC vs OFB-MAC Vulnerability](#cbc-mac-vs-ofb-mac-vulnerability)
10
+ - [Non-Permutation S-box Collision Attack](#non-permutation-s-box-collision-attack)
11
+ - [LCG Partial Output Recovery (0xFun 2026)](#lcg-partial-output-recovery-0xfun-2026)
12
+ - [Weak Hash Functions / GF(2) Gaussian Elimination](#weak-hash-functions--gf2-gaussian-elimination)
13
+ - [Affine Cipher over Composite Modulus (Nullcon 2026)](#affine-cipher-over-composite-modulus-nullcon-2026)
14
+ - [AES-GCM with Derived Keys (EHAX 2026)](#aes-gcm-with-derived-keys-ehax-2026)
15
+ - [Ascon-like Reduced-Round Differential Cryptanalysis (srdnlenCTF 2026)](#ascon-like-reduced-round-differential-cryptanalysis-srdnlenctf-2026)
16
+ - [Custom Linear MAC Forgery (Nullcon 2026)](#custom-linear-mac-forgery-nullcon-2026)
17
+ - [CBC Padding Oracle Attack](#cbc-padding-oracle-attack)
18
+ - [Bleichenbacher / PKCS#1 v1.5 RSA Padding Oracle](#bleichenbacher--pkcs1-v15-rsa-padding-oracle)
19
+ - [Birthday Attack / Meet-in-the-Middle](#birthday-attack--meet-in-the-middle)
20
+ - [LFSR Stream Cipher Attacks](#lfsr-stream-cipher-attacks)
21
+ - [Berlekamp-Massey Algorithm](#berlekamp-massey-algorithm)
22
+ - [Correlation Attack](#correlation-attack)
23
+ - [Known-Plaintext on LFSR Keystream](#known-plaintext-on-lfsr-keystream)
24
+ - [Galois vs Fibonacci LFSR](#galois-vs-fibonacci-lfsr)
25
+ - [Common LFSR Lengths and Polynomials](#common-lfsr-lengths-and-polynomials)
26
+ - [CRC32 Collision-Based Signature Forgery (iCTF 2013)](#crc32-collision-based-signature-forgery-ictf-2013)
27
+ - [Blum-Goldwasser Bit-Extension Oracle (PlaidCTF 2013)](#blum-goldwasser-bit-extension-oracle-plaidctf-2013)
28
+ - [Hash Length Extension Attack (PlaidCTF 2014)](#hash-length-extension-attack-plaidctf-2014)
29
+ - [Compression Oracle / CRIME-Style Attack (BCTF 2015)](#compression-oracle--crime-style-attack-bctf-2015)
30
+ - [RC4 Second-Byte Bias Distinguisher (Hackover CTF 2015)](#rc4-second-byte-bias-distinguisher-hackover-ctf-2015)
31
+ - [XOR Consecutive Byte Correlation Attack (Defcamp 2015)](#xor-consecutive-byte-correlation-attack-defcamp-2015)
32
+ - [Hash Function Time Reversal via Cycle Detection (BSidesSF 2025)](#hash-function-time-reversal-via-cycle-detection-bsidessf-2025)
33
+
34
+ ---
35
+
36
+ ## AES-CFB-8 Static IV State Forging
37
+
38
+ **Pattern (Cleverly Forging Breaks):** AES-CFB with 8-bit feedback and reused IV allows state reconstruction.
39
+
40
+ **Key insight:** After encrypting 16 known bytes, the AES internal shift register state is fully determined by those ciphertext bytes. Forge new ciphertexts by continuing encryption from known state.
41
+
42
+ ---
43
+
44
+ ## ECB Pattern Leakage on Images
45
+
46
+ **Pattern (Electronic Christmas Book):** AES-ECB on BMP/image data preserves visual patterns.
47
+
48
+ **Exploitation:** Identical plaintext blocks produce identical ciphertext blocks, revealing image structure even when encrypted. Rearrange or identify patterns visually.
49
+
50
+ ---
51
+
52
+ ## Padding Oracle Attack
53
+
54
+ **Pattern (The Seer):** Server reveals whether decrypted padding is valid.
55
+
56
+ **Byte-by-byte decryption:**
57
+ ```python
58
+ def decrypt_byte(block, prev_block, position, oracle, known):
59
+ """known = bytearray(16) tracking recovered intermediate bytes for this block."""
60
+ for guess in range(256):
61
+ modified = bytearray(prev_block)
62
+ # Set known bytes to produce valid padding
63
+ pad_value = 16 - position
64
+ for j in range(position + 1, 16):
65
+ modified[j] = known[j] ^ pad_value
66
+ modified[position] = guess
67
+ if oracle(bytes(modified) + block):
68
+ return guess ^ pad_value
69
+ ```
70
+
71
+ ---
72
+
73
+ ## CBC-MAC vs OFB-MAC Vulnerability
74
+
75
+ OFB mode creates a keystream that can be XORed for signature forgery.
76
+
77
+ **Attack:** If you have signature for known plaintext P1, forge for P2:
78
+ ```text
79
+ new_sig = known_sig XOR block2_of_P1 XOR block2_of_P2
80
+ ```
81
+
82
+ **Important:** Don't forget PKCS#7 padding in calculations! Small bruteforce space? Just try all combinations (e.g., 100 for 2 unknown digits).
83
+
84
+ ---
85
+
86
+ ## Non-Permutation S-box Collision Attack
87
+
88
+ **Pattern (Tetraes, Nullcon 2026):** Custom AES-like cipher with S-box collisions.
89
+
90
+ **Detection:** `len(set(sbox)) < 256` means collisions exist. Find collision pairs and their XOR delta.
91
+
92
+ **Attack:** For each key byte, try 256 plaintexts differing by delta. When `ct1 == ct2`, S-box input was in collision set. 2-way ambiguity per byte, 2^16 brute-force. Total: 4,097 oracle queries.
93
+
94
+ See [advanced-math.md](advanced-math.md) for full S-box collision analysis code.
95
+
96
+ ---
97
+
98
+ ## LCG Partial Output Recovery (0xFun 2026)
99
+
100
+ **Known parameters:** If LCG (Linear Congruential Generator) constants (M, A, C) are known and output is `state mod N`, iterate by N through modulus to find state:
101
+ ```python
102
+ # output = state % N, state = (A * prev + C) % M
103
+ for candidate in range(output, M, N):
104
+ # Check if candidate is consistent with next output
105
+ next_state = (A * candidate + C) % M
106
+ if next_state % N == next_output:
107
+ print(f"State: {candidate}")
108
+ ```
109
+
110
+ **Upper bits only (e.g., upper 32 of 64):** Brute-force lower 32 bits:
111
+ ```python
112
+ for low in range(2**32):
113
+ state = (observed_upper << 32) | low
114
+ next_state = (A * state + C) % M
115
+ if (next_state >> 32) == next_observed_upper:
116
+ print(f"Full state: {state}")
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Weak Hash Functions / GF(2) Gaussian Elimination
122
+
123
+ Linear permutations (only XOR, rotations) are algebraically attackable. Build transformation matrix and solve over GF(2).
124
+
125
+ ```python
126
+ import numpy as np
127
+
128
+ def solve_gf2(A, b):
129
+ """Solve Ax = b over GF(2)."""
130
+ m, n = A.shape
131
+ Aug = np.hstack([A, b.reshape(-1, 1)]) % 2
132
+ pivot_cols, row = [], 0
133
+ for col in range(n):
134
+ pivot = next((r for r in range(row, m) if Aug[r, col]), None)
135
+ if pivot is None: continue
136
+ Aug[[row, pivot]] = Aug[[pivot, row]]
137
+ for r in range(m):
138
+ if r != row and Aug[r, col]: Aug[r] = (Aug[r] + Aug[row]) % 2
139
+ pivot_cols.append((row, col)); row += 1
140
+ if any(Aug[r, -1] for r in range(row, m)): return None
141
+ x = np.zeros(n, dtype=np.uint8)
142
+ for r, c in reversed(pivot_cols):
143
+ x[c] = Aug[r, -1] ^ sum(Aug[r, c2] * x[c2] for c2 in range(c+1, n)) % 2
144
+ return x
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Affine Cipher over Composite Modulus (Nullcon 2026)
150
+
151
+ Affine encryption `c = A*x + b (mod M)` with composite M: split into prime factor fields, invert independently, CRT recombine. See [advanced-math.md](advanced-math.md#affine-cipher-over-non-prime-modulus-nullcon-2026) for full chosen-plaintext key recovery and implementation.
152
+
153
+ ---
154
+
155
+ ## AES-GCM with Derived Keys (EHAX 2026)
156
+
157
+ **Pattern:** Final decryption step after recovering a secret (e.g., from LWE, key exchange). Session nonce and AES key derived via SHA-256 hashing of the recovered secret.
158
+
159
+ ```python
160
+ import hashlib
161
+ from Cryptodome.Cipher import AES
162
+
163
+ # Common key derivation chain:
164
+ # 1. Recover secret bytes (s_bytes) from crypto challenge
165
+ # 2. Unwrap session nonce: nonce = wrapped_nonce XOR SHA256(s_bytes)[:nonce_len]
166
+ # 3. Derive AES key: key = SHA256(s_bytes + session_nonce)
167
+ # 4. Decrypt AES-GCM
168
+
169
+ def decrypt_with_derived_key(s_bytes, wrapped_nonce, ciphertext, aes_nonce, tag, nonce_len=16):
170
+ secret_hash = hashlib.sha256(s_bytes).digest()
171
+ session_nonce = bytes(a ^ b for a, b in zip(wrapped_nonce, secret_hash[:nonce_len]))
172
+ aes_key = hashlib.sha256(s_bytes + session_nonce).digest()
173
+ cipher = AES.new(aes_key, AES.MODE_GCM, nonce=aes_nonce)
174
+ return cipher.decrypt_and_verify(ciphertext, tag)
175
+ ```
176
+
177
+ **Key insight:** When AES-GCM authentication fails (`ValueError: MAC check failed`), the derived key is wrong — usually means the upstream secret recovery was incorrect or endianness is swapped.
178
+
179
+ ---
180
+
181
+ ## Ascon-like Reduced-Round Differential Cryptanalysis (srdnlenCTF 2026)
182
+
183
+ **Pattern (Lightweight):** 4-round Ascon-like permutation with reduced diffusion. Key-dependent biases in output-bit differentials allow key recovery via chosen input differences.
184
+
185
+ **Attack:**
186
+ 1. Reproduce the permutation exactly (critical: post-S-box x4 assignment order matters)
187
+ 2. Invert the linear layer of x0 using a precomputed 64×64 GF(2) inverse matrix
188
+ 3. For each bit position i, query with `diff = (1<<i, 1<<i)` across multiple samples
189
+ 4. Measure empirical biases at output bits `j1 = (i+1) mod 64` and `j2 = (i+14) mod 64`
190
+ 5. Classify key bits `(k0[i], k1[i])` via centroid-based clustering with sign-pattern mask
191
+ 6. Verify candidate key in-session; refine low-margin bits with additional samples
192
+
193
+ **GF(2) linear layer inversion:**
194
+ ```python
195
+ def build_inverse(shifts=(19, 28)):
196
+ """Construct GF(2) inverse matrix for Ascon-like linear layer: x ^= rot(x,19) ^ rot(x,28)."""
197
+ # Build 64x64 matrix over GF(2)
198
+ M = [[0]*64 for _ in range(64)]
199
+ for out_bit in range(64):
200
+ M[out_bit][out_bit] = 1
201
+ for shift in shifts:
202
+ M[out_bit][(out_bit + shift) % 64] ^= 1
203
+ # Gaussian elimination to find inverse
204
+ aug = [row + [1 if i == j else 0 for j in range(64)] for i, row in enumerate(M)]
205
+ for col in range(64):
206
+ pivot = next(r for r in range(col, 64) if aug[r][col])
207
+ aug[col], aug[pivot] = aug[pivot], aug[col]
208
+ for r in range(64):
209
+ if r != col and aug[r][col]:
210
+ aug[r] = [a ^ b for a, b in zip(aug[r], aug[col])]
211
+ return [row[64:] for row in aug]
212
+ ```
213
+
214
+ **Centroid clustering for key classification:**
215
+ ```python
216
+ # For each bit position, measure bias at two output positions
217
+ # 4 possible (k0[i], k1[i]) pairs → 4 centroid patterns
218
+ # Uses sign-pattern mask CMASK=0x73 to account for bit-position-dependent behavior
219
+ # Classify by minimum Euclidean distance in 2D bias space
220
+ CMASK = 0x73
221
+ for i in range(64):
222
+ bias_j1, bias_j2 = measure_biases(i, samples)
223
+ mask_bit = (CMASK >> (i % 8)) & 1
224
+ centroids = centroid_table[mask_bit] # Precomputed per-position centroids
225
+ k0_bit, k1_bit = min(range(4), key=lambda c: euclidean_dist(
226
+ (bias_j1, bias_j2), centroids[c]))
227
+ ```
228
+
229
+ **Key insight:** Reduced-round lightweight ciphers (Ascon, GIFT, etc.) have exploitable biases when the number of rounds is insufficient for full diffusion. The linear layer's inverse can be computed algebraically, and differential biases measured across chosen-plaintext queries reveal individual key bits. This is practical even with noisy measurements if you collect enough samples.
230
+
231
+ ---
232
+
233
+ ## Custom Linear MAC Forgery (Nullcon 2026)
234
+
235
+ **Pattern (Pasty):** Server signs paste IDs with a custom SHA-256-based construction. The signature is linear in three 8-byte secret blocks derived from the key.
236
+
237
+ **Structure:** For each 8-byte output block `i`:
238
+ - `selector = SHA256(id)[i*8] % 3` → chooses which secret block to use
239
+ - `out[i] = hash_block[i] XOR secret[selector] XOR chain[i-1]`
240
+
241
+ **Recovery:** Create ~10 pastes to collect `(id, sig)` pairs. Each pair reveals `secret[selector]` for 4 selectors. With ~4-5 pairs, all 3 secret blocks are recovered. Then forge for target ID.
242
+
243
+ **Key insight:** Linearity in custom crypto constructions (XOR-based signing) makes them trivially forgeable. Always check if the MAC has the property: knowing the secret components lets you compute valid signatures for arbitrary inputs.
244
+
245
+ ---
246
+
247
+ ## CBC Padding Oracle Attack
248
+
249
+ **Pattern:** Server reveals whether CBC-mode ciphertext has valid PKCS#7 padding (via error messages, timing, or status codes). Decrypt any ciphertext block-by-block without the key.
250
+
251
+ ```python
252
+ from pwn import *
253
+
254
+ def padding_oracle(iv, ct):
255
+ """Returns True if server accepts padding."""
256
+ resp = requests.post(URL, data={'iv': iv.hex(), 'ct': ct.hex()})
257
+ return 'padding' not in resp.text.lower() # or check status code
258
+
259
+ def decrypt_block(prev_block, target_block):
260
+ """Decrypt one 16-byte block using padding oracle."""
261
+ intermediate = bytearray(16)
262
+ plaintext = bytearray(16)
263
+
264
+ for byte_pos in range(15, -1, -1):
265
+ pad_val = 16 - byte_pos
266
+ # Set already-known bytes to produce correct padding
267
+ crafted = bytearray(16)
268
+ for k in range(byte_pos + 1, 16):
269
+ crafted[k] = intermediate[k] ^ pad_val
270
+
271
+ for guess in range(256):
272
+ crafted[byte_pos] = guess
273
+ if padding_oracle(bytes(crafted), target_block):
274
+ intermediate[byte_pos] = guess ^ pad_val
275
+ plaintext[byte_pos] = intermediate[byte_pos] ^ prev_block[byte_pos]
276
+ break
277
+
278
+ return bytes(plaintext)
279
+ ```
280
+
281
+ **Tools:**
282
+ ```bash
283
+ # PadBuster — automated padding oracle exploitation
284
+ padbuster http://target/decrypt.php ENCRYPTED_B64 16 \
285
+ -encoding 0 -error "Invalid padding"
286
+
287
+ # Python: pip install padding-oracle
288
+ from padding_oracle import PaddingOracle
289
+ oracle = PaddingOracle(block_size=16, oracle_fn=check_padding)
290
+ plaintext = oracle.decrypt(ciphertext, iv=iv)
291
+ ```
292
+
293
+ **Key insight:** The oracle only needs to distinguish "valid padding" from "invalid padding." This can be a different HTTP status code, error message, response time, or even whether the application processes the request further. A single bit of information per query is sufficient. Decryption requires at most 256 x 16 = 4096 queries per block.
294
+
295
+ **Detection:** CBC mode encryption + any distinguishable behavior difference on padding errors. Common in cookie encryption, token systems, and encrypted API parameters.
296
+
297
+ ---
298
+
299
+ ## Bleichenbacher / PKCS#1 v1.5 RSA Padding Oracle
300
+
301
+ **Pattern:** RSA encryption with PKCS#1 v1.5 padding where the server reveals whether decrypted plaintext has valid `0x00 0x02` prefix. Adaptive chosen-ciphertext attack recovers the plaintext.
302
+
303
+ ```python
304
+ import gmpy2
305
+
306
+ def bleichenbacher_oracle(c, n, e):
307
+ """Returns True if RSA decryption has valid PKCS#1 v1.5 padding (0x00 0x02 prefix)."""
308
+ resp = send_to_server(c)
309
+ return resp.status_code != 400 # Server returns 400 on bad padding
310
+
311
+ def bleichenbacher_attack(c0, n, e, oracle, k):
312
+ """
313
+ c0: target ciphertext (integer)
314
+ k: byte length of modulus (e.g., 256 for RSA-2048)
315
+ """
316
+ B = pow(2, 8 * (k - 2))
317
+
318
+ # Step 1: Start with s1 = ceil(n / 3B)
319
+ s = (n + 3 * B - 1) // (3 * B)
320
+
321
+ # Step 2: Search for s where oracle(c0 * s^e mod n) is True
322
+ while True:
323
+ c_prime = (c0 * pow(s, e, n)) % n
324
+ if oracle(c_prime, n, e):
325
+ break
326
+ s += 1
327
+
328
+ # Step 3: Narrow interval [a, b] using s values
329
+ # Repeat: find new s, narrow interval, until a == b
330
+ # When interval collapses, plaintext = a * modinv(s, n) % n
331
+ # (Full implementation requires interval tracking — use existing tools)
332
+ ```
333
+
334
+ **Tools:**
335
+ ```bash
336
+ # ROBOT attack scanner (modern Bleichenbacher variant)
337
+ python3 robot-detect.py -H target.com
338
+
339
+ # TLS-Attacker framework
340
+ java -jar TLS-Attacker.jar -connect target:443 -workflow_type BLEICHENBACHER
341
+ ```
342
+
343
+ **Key insight:** The attack is adaptive — each oracle response narrows the range of possible plaintexts. Typically requires ~10,000 oracle queries for RSA-2048. The ROBOT attack (Return Of Bleichenbacher's Oracle Threat) showed this affects modern TLS implementations through subtle timing differences. Any server that distinguishes "bad padding" from "bad content" is vulnerable.
344
+
345
+ ---
346
+
347
+ ## Birthday Attack / Meet-in-the-Middle
348
+
349
+ **Pattern:** Find collisions in hash functions or MACs using the birthday paradox. With an n-bit hash, expect a collision after ~2^(n/2) random inputs.
350
+
351
+ ```python
352
+ import hashlib, os
353
+
354
+ def birthday_collision(hash_fn, output_bits, prefix=b''):
355
+ """Find two inputs with the same truncated hash."""
356
+ target_bytes = output_bits // 8
357
+ seen = {}
358
+
359
+ while True:
360
+ msg = prefix + os.urandom(16)
361
+ h = hash_fn(msg).digest()[:target_bytes]
362
+ if h in seen:
363
+ return seen[h], msg # Collision found!
364
+ seen[h] = msg
365
+
366
+ # Example: find collision on first 4 bytes of SHA-256 (~65536 attempts)
367
+ msg1, msg2 = birthday_collision(hashlib.sha256, 32)
368
+ ```
369
+
370
+ **Meet-in-the-Middle (2DES, double encryption):**
371
+ ```python
372
+ def meet_in_the_middle(encrypt_fn, decrypt_fn, plaintext, ciphertext, keyspace):
373
+ """Break double encryption E(k2, E(k1, pt)) = ct."""
374
+ # Forward: encrypt plaintext with all possible k1
375
+ forward = {}
376
+ for k1 in keyspace:
377
+ intermediate = encrypt_fn(k1, plaintext)
378
+ forward[intermediate] = k1
379
+
380
+ # Backward: decrypt ciphertext with all possible k2
381
+ for k2 in keyspace:
382
+ intermediate = decrypt_fn(k2, ciphertext)
383
+ if intermediate in forward:
384
+ return forward[intermediate], k2 # Found k1, k2!
385
+ ```
386
+
387
+ **Key insight:** Birthday attack: n-bit hash needs ~2^(n/2) queries for 50% collision probability. 32-bit hash -> ~65K, 64-bit -> ~4 billion. Meet-in-the-middle reduces double encryption from O(2^(2k)) to O(2^k) time + O(2^k) space — this is why 2DES provides only 1 extra bit of security over DES.
388
+
389
+ ---
390
+
391
+ ## LFSR Stream Cipher Attacks
392
+
393
+ Linear Feedback Shift Registers generate keystreams from an initial state and feedback polynomial. Common in CTF crypto challenges and lightweight/custom ciphers.
394
+
395
+ **Detection:** Look for bit-level operations (XOR, shift, AND with tap mask), short repeating keystreams, or challenge descriptions mentioning "stream cipher", "LFSR", "shift register", or "linear recurrence".
396
+
397
+ ### Berlekamp-Massey Algorithm
398
+
399
+ **Pattern:** Given a portion of known keystream (from known plaintext XOR), recover the minimal LFSR that generates it. Once you have the feedback polynomial and state, predict all future (and past) output.
400
+
401
+ **Key insight:** Berlekamp-Massey finds the shortest LFSR producing a given sequence in O(n^2). If you have 2L consecutive keystream bits (where L is the LFSR length), you can fully recover the LFSR.
402
+
403
+ ```python
404
+ from sage.all import *
405
+
406
+ # Known keystream bits (from known plaintext XOR ciphertext)
407
+ keystream = [1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1]
408
+
409
+ # Berlekamp-Massey in SageMath
410
+ F = GF(2)
411
+ seq = [F(b) for b in keystream]
412
+ R = berlekamp_massey(seq) # Returns the feedback polynomial
413
+ print(f"LFSR polynomial: {R}")
414
+ print(f"LFSR length: {R.degree()}")
415
+
416
+ # Recover initial state from first L bits
417
+ L = R.degree()
418
+ state = keystream[:L]
419
+
420
+ # Generate future keystream
421
+ def lfsr_next(state, taps):
422
+ """taps = list of tap positions from polynomial"""
423
+ new_bit = 0
424
+ for t in taps:
425
+ new_bit ^= state[t]
426
+ return state[1:] + [new_bit]
427
+ ```
428
+
429
+ ### Correlation Attack
430
+
431
+ **Pattern:** Combined LFSR generator (multiple LFSRs combined through a nonlinear function). If the combining function has correlation bias toward one LFSR's output, attack that LFSR independently.
432
+
433
+ **Key insight:** If `P(output = LFSR_i output) > 0.5`, brute-force LFSR_i's initial state (2^L candidates for length-L LFSR) and check correlation with known keystream. Much faster than brute-forcing the full combined state.
434
+
435
+ ```python
436
+ # Correlation attack on a single biased LFSR
437
+ def correlation_attack(keystream_bits, lfsr_length, taps, threshold=0.6):
438
+ """Try all 2^L initial states, keep those with high correlation"""
439
+ best_corr, best_state = 0, None
440
+ for seed in range(2**lfsr_length):
441
+ state = [(seed >> i) & 1 for i in range(lfsr_length)]
442
+ matches = 0
443
+ s = state[:]
444
+ for i, bit in enumerate(keystream_bits):
445
+ if s[0] == bit:
446
+ matches += 1
447
+ s = lfsr_next(s, taps)
448
+ corr = matches / len(keystream_bits)
449
+ if corr > best_corr:
450
+ best_corr, best_state = corr, seed
451
+ return best_state, best_corr
452
+ ```
453
+
454
+ ### Known-Plaintext on LFSR Keystream
455
+
456
+ **Pattern:** XOR known plaintext with ciphertext to get keystream. With >=2L keystream bits, solve the linear system directly.
457
+
458
+ ```python
459
+ import numpy as np
460
+
461
+ # Given 2L keystream bits, solve for L-bit state + L feedback taps
462
+ # Keystream relation: k[i+L] = c[0]*k[i] + c[1]*k[i+1] + ... + c[L-1]*k[i+L-1] (mod 2)
463
+ def solve_lfsr(keystream, L):
464
+ """Solve for LFSR feedback from 2L keystream bits over GF(2)"""
465
+ # Build matrix: each row is [k[i], k[i+1], ..., k[i+L-1]] = k[i+L]
466
+ A = []
467
+ b = []
468
+ for i in range(L):
469
+ A.append(keystream[i:i+L])
470
+ b.append(keystream[i+L])
471
+ # Solve over GF(2) using SageMath
472
+ from sage.all import matrix, vector, GF
473
+ M = matrix(GF(2), A)
474
+ v = vector(GF(2), b)
475
+ coeffs = M.solve_right(v)
476
+ return list(coeffs)
477
+ ```
478
+
479
+ ### Galois vs Fibonacci LFSR
480
+
481
+ Two equivalent representations — same keystream, different wiring:
482
+ - **Fibonacci:** feedback from multiple taps XOR'd into last position (most common in CTFs)
483
+ - **Galois:** feedback distributed across the register (faster in hardware)
484
+
485
+ Conversion: Galois polynomial is the reciprocal of Fibonacci polynomial. Most CTF tools assume Fibonacci form.
486
+
487
+ ### Common LFSR Lengths and Polynomials
488
+
489
+ | Bits | Common primitive polynomial | Period |
490
+ |------|---------------------------|--------|
491
+ | 16 | x^16 + x^14 + x^13 + x^11 + 1 | 65535 |
492
+ | 32 | x^32 + x^22 + x^2 + x + 1 | 2^32 - 1 |
493
+ | 64 | x^64 + x^4 + x^3 + x + 1 | 2^64 - 1 |
494
+
495
+ **Maximal-length LFSR:** Primitive polynomial -> period = 2^L - 1 (visits all nonzero states).
496
+
497
+ ---
498
+
499
+ ## CRC32 Collision-Based Signature Forgery (iCTF 2013)
500
+
501
+ **Pattern:** CRC32 is linear — appending 4 carefully chosen bytes to any message produces a target CRC32 value, enabling signature forgery without knowing the secret key.
502
+
503
+ **Key insight:** `CRC32(msg || secret)` is not a secure MAC. Given any signed response `(msg, sig)`, compute 4 suffix bytes that force `CRC32(forged_msg || suffix || secret) == target_sig`. The linearity of CRC32 means the suffix computation is deterministic and instant.
504
+
505
+ ```python
506
+ import struct, binascii
507
+
508
+ def crc32_forge(data, target_crc):
509
+ """Append 4 bytes to data so CRC32(data + suffix) == target_crc"""
510
+ current = binascii.crc32(data) & 0xFFFFFFFF
511
+ # CRC32 polynomial table lookup to find suffix bytes
512
+ # that transform current CRC into target_crc
513
+ suffix = b''
514
+ crc = target_crc ^ 0xFFFFFFFF
515
+ for _ in range(4):
516
+ byte = (crc & 0xFF)
517
+ crc = (crc >> 8)
518
+ suffix = bytes([byte]) + suffix
519
+ return data + suffix # Simplified — full implementation requires polynomial division
520
+ ```
521
+
522
+ **When to use:** Any protocol using CRC32 as a message authentication code (MAC). CRC32 is a checksum, not a cryptographic hash — it provides no integrity guarantees against adversarial modification.
523
+
524
+ ---
525
+
526
+ ## Blum-Goldwasser Bit-Extension Oracle (PlaidCTF 2013)
527
+
528
+ **Pattern:** Exploit a decryption oracle for Blum-Goldwasser-style encryption by extending ciphertext length by one bit per query to leak plaintext via parity.
529
+
530
+ **Key insight:** Extend ciphertext by one bit (L+1), shift ciphertext left (`c << 1`), and submit a modified `y` value. The oracle reveals the LSB (parity) of each decrypted chunk. The squaring sequence `y = pow(y, 2, N)` can be manipulated to produce valid extended ciphertexts the server hasn't seen.
531
+
532
+ ```python
533
+ # Iterative plaintext recovery via bit-extension
534
+ for i in range(msg_length):
535
+ extended_c = original_c << 1 # Shift ciphertext left by 1
536
+ new_y = pow(original_y, 2, N) # Advance squaring sequence
537
+ response = oracle(extended_c, new_y, msg_length + 1)
538
+ leaked_bit = response & 1 # LSB reveals one plaintext bit
539
+ plaintext_bits.append(leaked_bit)
540
+ original_y = new_y
541
+ ```
542
+
543
+ **When to use:** Blum-Goldwasser or BBS-based (Blum Blum Shub) encryption with a decryption oracle that accepts variable-length ciphertexts. The parity leak accumulates one bit per query.
544
+
545
+ ---
546
+
547
+ ## Hash Length Extension Attack (PlaidCTF 2014)
548
+
549
+ **Pattern:** Server computes `hash(SECRET || user_data)` using MD5, SHA-1, or SHA-256 (Merkle-Damgard constructions). Given a valid hash and the original data, extend it with arbitrary appended data and compute a valid hash — without knowing the secret.
550
+
551
+ ```bash
552
+ # Using HashPump (install: apt install hashpump)
553
+ hashpump --keylength 8 \
554
+ --signature 'ef16c2bffbcf0b7567217f292f9c2a9a50885e01e002fa34db34c0bb916ed5c3' \
555
+ --data 'original_data' \
556
+ --additional ';admin=true'
557
+ # Outputs: new_signature and new_data (with padding bytes)
558
+ ```
559
+
560
+ ```python
561
+ # Python: hashpumpy
562
+ import hashpumpy
563
+ new_hash, new_data = hashpumpy.hashpump(
564
+ original_hash, original_data, append_data, secret_length
565
+ )
566
+ ```
567
+
568
+ **Key insight:** Merkle-Damgard hashes (MD5, SHA-1, SHA-256) process data in blocks, and the hash output IS the internal state. Given `H(secret || msg)`, you can compute `H(secret || msg || padding || extension)` without knowing `secret` — just initialize the hash state from the known output and continue hashing. Only HMAC (`H(K XOR opad || H(K XOR ipad || msg))`) is immune. If the secret length is unknown, try lengths 1-32.
569
+
570
+ ---
571
+
572
+ ## Compression Oracle / CRIME-Style Attack (BCTF 2015)
573
+
574
+ **Pattern:** Server compresses plaintext (LZW, zlib, etc.) before encrypting. By observing ciphertext length changes with chosen plaintexts, leak the unknown plaintext character-by-character.
575
+
576
+ ```python
577
+ import base64
578
+
579
+ def oracle(plaintext):
580
+ """Send chosen plaintext, get ciphertext length."""
581
+ resp = send_to_server(plaintext)
582
+ return len(base64.b64decode(resp))
583
+
584
+ # Baseline: empty input
585
+ base_len = oracle("")
586
+
587
+ # Recover secret byte-by-byte
588
+ known = ""
589
+ for pos in range(secret_length):
590
+ for c in string.printable:
591
+ candidate = known + c
592
+ length = oracle(candidate)
593
+ if length <= base_len + len(known): # Compressed = match
594
+ known += c
595
+ break
596
+ ```
597
+
598
+ **Key insight:** Compression algorithms (LZW, DEFLATE, zlib) replace repeated sequences with back-references. If `SALT + user_input` is compressed before encryption, sending input that matches part of the salt produces shorter ciphertext (the match compresses). This is the same class as CRIME (TLS), BREACH (HTTP), and HEIST attacks. The oracle is ciphertext length.
599
+
600
+ ---
601
+
602
+ ## RC4 Second-Byte Bias Distinguisher (Hackover CTF 2015)
603
+
604
+ **Pattern:** Distinguish RC4 output from true random data by exploiting RC4's second-byte bias. The second output byte of RC4 is biased toward `0x00` with probability 1/128 (vs expected 1/256).
605
+
606
+ ```python
607
+ count_zero = 0
608
+ for sample in all_samples:
609
+ if sample[1] == 0x00: # second byte
610
+ count_zero += 1
611
+
612
+ # Expected: random = N/256, RC4 = N/128 (2x more zeros)
613
+ if count_zero > threshold:
614
+ print("RC4")
615
+ else:
616
+ print("Random")
617
+ ```
618
+
619
+ **Key insight:** RC4's key scheduling creates a well-known bias where `P(second_byte == 0) = 1/128` instead of `1/256`. With ~2048 samples, RC4 produces ~16 zero second-bytes vs ~8 for random. Other RC4 biases: bytes 3-255 show weaker biases; long-term biases exist at every 256th position.
620
+
621
+ ---
622
+
623
+ ## XOR Consecutive Byte Correlation Attack (Defcamp 2015)
624
+
625
+ When a cipher XORs consecutive ciphertext bytes, the relationship between two ciphertexts reveals plaintext differences without knowing the key:
626
+
627
+ ```python
628
+ # Observation: xorct[i] = ct[i] ^ ct[i+1]
629
+ # For two ciphertext/plaintext pairs:
630
+ # plain2[i] ^ plain1[i] == xorct1[i] ^ xorct2[i]
631
+
632
+ # With one known plaintext, decrypt the other:
633
+ for i in range(len(ct2)):
634
+ xorct1 = ct1[i] ^ ct1[i+1]
635
+ xorct2 = ct2[i] ^ ct2[i+1]
636
+ plain2_char = xorct1 ^ xorct2 ^ plain1[i]
637
+ ```
638
+
639
+ **Key insight:** XOR of consecutive bytes cancels key material, leaving only plaintext-dependent differences. One known plaintext breaks all subsequent messages.
640
+
641
+ ---
642
+
643
+ ## Hash Function Time Reversal via Cycle Detection (BSidesSF 2025)
644
+
645
+ When a system uses iterated hashing as a "time" function (`state_t = H(state_{t-1})`), reverse time by exploiting the finite cycle structure:
646
+
647
+ 1. **Detect cycle:** Use Floyd's tortoise-and-hare or Brent's algorithm to find cycle length L
648
+ 2. **Compute backward steps:** To go from time T to earlier time T_goal: iterate forward `(L - (T - T_goal)) % L` steps
649
+
650
+ ```python
651
+ import hashlib
652
+
653
+ def hash_step(state):
654
+ return hashlib.md5(state).digest()[:8] # Truncated hash
655
+
656
+ def find_cycle(start):
657
+ """Brent's cycle detection: returns (cycle_length, start_of_cycle)"""
658
+ power = lam = 1
659
+ tortoise = start
660
+ hare = hash_step(start)
661
+ while tortoise != hare:
662
+ if power == lam:
663
+ tortoise = hare
664
+ power *= 2
665
+ lam = 0
666
+ hare = hash_step(hare)
667
+ lam += 1
668
+ # lam = cycle length; find cycle start
669
+ tortoise = hare = start
670
+ for _ in range(lam):
671
+ hare = hash_step(hare)
672
+ mu = 0
673
+ while tortoise != hare:
674
+ tortoise = hash_step(tortoise)
675
+ hare = hash_step(hare)
676
+ mu += 1
677
+ return lam, mu # cycle_length, cycle_start_offset
678
+
679
+ # Reverse from T_known to T_goal
680
+ cycle_len, _ = find_cycle(known_state)
681
+ forward_steps = (cycle_len - (t_known - t_goal)) % cycle_len
682
+ state = known_state
683
+ for _ in range(forward_steps):
684
+ state = hash_step(state)
685
+ # state is now the value at t_goal
686
+ ```
687
+
688
+ **Key insight:** For truncated hashes (e.g., MD5 -> 64 bits), the expected cycle length is ~2^32, making cycle detection feasible. Going "backward" N steps is equivalent to going forward (cycle_length - N) steps. Assumes the target state is within the main cycle, not on a tail.