@wazir-dev/cli 1.0.0

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 (629) hide show
  1. package/AGENTS.md +111 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CONTRIBUTING.md +101 -0
  4. package/LICENSE +21 -0
  5. package/README.md +314 -0
  6. package/assets/composition-engine.mmd +34 -0
  7. package/assets/demo-script.sh +17 -0
  8. package/assets/logo-dark.svg +14 -0
  9. package/assets/logo.svg +14 -0
  10. package/assets/pipeline.mmd +39 -0
  11. package/assets/record-demo.sh +51 -0
  12. package/docs/README.md +51 -0
  13. package/docs/adapters/context-mode.md +60 -0
  14. package/docs/concepts/architecture.md +87 -0
  15. package/docs/concepts/artifact-model.md +60 -0
  16. package/docs/concepts/composition-engine.md +36 -0
  17. package/docs/concepts/indexing-and-recall.md +160 -0
  18. package/docs/concepts/observability.md +41 -0
  19. package/docs/concepts/roles-and-workflows.md +59 -0
  20. package/docs/concepts/terminology-policy.md +27 -0
  21. package/docs/getting-started/01-installation.md +78 -0
  22. package/docs/getting-started/02-first-run.md +102 -0
  23. package/docs/getting-started/03-adding-to-project.md +15 -0
  24. package/docs/getting-started/04-host-setup.md +15 -0
  25. package/docs/guides/ci-integration.md +15 -0
  26. package/docs/guides/creating-skills.md +15 -0
  27. package/docs/guides/expertise-module-authoring.md +15 -0
  28. package/docs/guides/hook-development.md +15 -0
  29. package/docs/guides/memory-and-learnings.md +34 -0
  30. package/docs/guides/multi-host-export.md +15 -0
  31. package/docs/guides/troubleshooting.md +101 -0
  32. package/docs/guides/writing-custom-roles.md +15 -0
  33. package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
  34. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
  35. package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
  36. package/docs/readmes/INDEX.md +99 -0
  37. package/docs/readmes/features/expertise/README.md +171 -0
  38. package/docs/readmes/features/exports/README.md +222 -0
  39. package/docs/readmes/features/hooks/README.md +103 -0
  40. package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
  41. package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
  42. package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
  43. package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
  44. package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
  45. package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
  46. package/docs/readmes/features/hooks/session-start.md +119 -0
  47. package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
  48. package/docs/readmes/features/roles/README.md +157 -0
  49. package/docs/readmes/features/roles/clarifier.md +152 -0
  50. package/docs/readmes/features/roles/content-author.md +190 -0
  51. package/docs/readmes/features/roles/designer.md +193 -0
  52. package/docs/readmes/features/roles/executor.md +184 -0
  53. package/docs/readmes/features/roles/learner.md +210 -0
  54. package/docs/readmes/features/roles/planner.md +182 -0
  55. package/docs/readmes/features/roles/researcher.md +164 -0
  56. package/docs/readmes/features/roles/reviewer.md +184 -0
  57. package/docs/readmes/features/roles/specifier.md +162 -0
  58. package/docs/readmes/features/roles/verifier.md +215 -0
  59. package/docs/readmes/features/schemas/README.md +178 -0
  60. package/docs/readmes/features/skills/README.md +63 -0
  61. package/docs/readmes/features/skills/brainstorming.md +96 -0
  62. package/docs/readmes/features/skills/debugging.md +148 -0
  63. package/docs/readmes/features/skills/design.md +120 -0
  64. package/docs/readmes/features/skills/prepare-next.md +109 -0
  65. package/docs/readmes/features/skills/run-audit.md +159 -0
  66. package/docs/readmes/features/skills/scan-project.md +109 -0
  67. package/docs/readmes/features/skills/self-audit.md +176 -0
  68. package/docs/readmes/features/skills/tdd.md +137 -0
  69. package/docs/readmes/features/skills/using-skills.md +92 -0
  70. package/docs/readmes/features/skills/verification.md +120 -0
  71. package/docs/readmes/features/skills/writing-plans.md +104 -0
  72. package/docs/readmes/features/tooling/README.md +320 -0
  73. package/docs/readmes/features/workflows/README.md +186 -0
  74. package/docs/readmes/features/workflows/author.md +181 -0
  75. package/docs/readmes/features/workflows/clarify.md +154 -0
  76. package/docs/readmes/features/workflows/design-review.md +171 -0
  77. package/docs/readmes/features/workflows/design.md +169 -0
  78. package/docs/readmes/features/workflows/discover.md +162 -0
  79. package/docs/readmes/features/workflows/execute.md +173 -0
  80. package/docs/readmes/features/workflows/learn.md +167 -0
  81. package/docs/readmes/features/workflows/plan-review.md +165 -0
  82. package/docs/readmes/features/workflows/plan.md +170 -0
  83. package/docs/readmes/features/workflows/prepare-next.md +167 -0
  84. package/docs/readmes/features/workflows/review.md +169 -0
  85. package/docs/readmes/features/workflows/run-audit.md +191 -0
  86. package/docs/readmes/features/workflows/spec-challenge.md +159 -0
  87. package/docs/readmes/features/workflows/specify.md +160 -0
  88. package/docs/readmes/features/workflows/verify.md +177 -0
  89. package/docs/readmes/packages/README.md +50 -0
  90. package/docs/readmes/packages/ajv.md +117 -0
  91. package/docs/readmes/packages/context-mode.md +118 -0
  92. package/docs/readmes/packages/gray-matter.md +116 -0
  93. package/docs/readmes/packages/node-test.md +137 -0
  94. package/docs/readmes/packages/yaml.md +112 -0
  95. package/docs/reference/configuration-reference.md +159 -0
  96. package/docs/reference/expertise-index.md +52 -0
  97. package/docs/reference/git-flow.md +43 -0
  98. package/docs/reference/hooks.md +87 -0
  99. package/docs/reference/host-exports.md +50 -0
  100. package/docs/reference/launch-checklist.md +172 -0
  101. package/docs/reference/marketplace-listings.md +76 -0
  102. package/docs/reference/release-process.md +34 -0
  103. package/docs/reference/roles-reference.md +77 -0
  104. package/docs/reference/skills.md +33 -0
  105. package/docs/reference/templates.md +29 -0
  106. package/docs/reference/tooling-cli.md +94 -0
  107. package/docs/truth-claims.yaml +222 -0
  108. package/expertise/PROGRESS.md +63 -0
  109. package/expertise/README.md +18 -0
  110. package/expertise/antipatterns/PROGRESS.md +56 -0
  111. package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
  112. package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
  113. package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
  114. package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
  115. package/expertise/antipatterns/backend/index.md +24 -0
  116. package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
  117. package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
  118. package/expertise/antipatterns/code/async-antipatterns.md +622 -0
  119. package/expertise/antipatterns/code/code-smells.md +1186 -0
  120. package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
  121. package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
  122. package/expertise/antipatterns/code/index.md +27 -0
  123. package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
  124. package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
  125. package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
  126. package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
  127. package/expertise/antipatterns/design/dark-patterns.md +1121 -0
  128. package/expertise/antipatterns/design/index.md +22 -0
  129. package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
  130. package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
  131. package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
  132. package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
  133. package/expertise/antipatterns/frontend/index.md +23 -0
  134. package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
  135. package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
  136. package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
  137. package/expertise/antipatterns/index.md +31 -0
  138. package/expertise/antipatterns/performance/index.md +20 -0
  139. package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
  140. package/expertise/antipatterns/performance/premature-optimization.md +623 -0
  141. package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
  142. package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
  143. package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
  144. package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
  145. package/expertise/antipatterns/process/index.md +23 -0
  146. package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
  147. package/expertise/antipatterns/security/index.md +20 -0
  148. package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
  149. package/expertise/antipatterns/security/security-theater.md +843 -0
  150. package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
  151. package/expertise/architecture/PROGRESS.md +70 -0
  152. package/expertise/architecture/data/caching-architecture.md +671 -0
  153. package/expertise/architecture/data/data-consistency.md +574 -0
  154. package/expertise/architecture/data/data-modeling.md +536 -0
  155. package/expertise/architecture/data/event-streams-and-queues.md +634 -0
  156. package/expertise/architecture/data/index.md +25 -0
  157. package/expertise/architecture/data/search-architecture.md +663 -0
  158. package/expertise/architecture/data/sql-vs-nosql.md +708 -0
  159. package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
  160. package/expertise/architecture/decisions/build-vs-buy.md +616 -0
  161. package/expertise/architecture/decisions/index.md +23 -0
  162. package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
  163. package/expertise/architecture/decisions/technology-selection.md +616 -0
  164. package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
  165. package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
  166. package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
  167. package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
  168. package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
  169. package/expertise/architecture/distributed/index.md +25 -0
  170. package/expertise/architecture/distributed/saga-pattern.md +797 -0
  171. package/expertise/architecture/foundations/architectural-thinking.md +460 -0
  172. package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
  173. package/expertise/architecture/foundations/design-principles-solid.md +649 -0
  174. package/expertise/architecture/foundations/domain-driven-design.md +719 -0
  175. package/expertise/architecture/foundations/index.md +25 -0
  176. package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
  177. package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
  178. package/expertise/architecture/index.md +34 -0
  179. package/expertise/architecture/integration/api-design-graphql.md +638 -0
  180. package/expertise/architecture/integration/api-design-grpc.md +804 -0
  181. package/expertise/architecture/integration/api-design-rest.md +892 -0
  182. package/expertise/architecture/integration/index.md +25 -0
  183. package/expertise/architecture/integration/third-party-integration.md +795 -0
  184. package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
  185. package/expertise/architecture/integration/websockets-realtime.md +791 -0
  186. package/expertise/architecture/mobile-architecture/index.md +22 -0
  187. package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
  188. package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
  189. package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
  190. package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
  191. package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
  192. package/expertise/architecture/patterns/event-driven.md +797 -0
  193. package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
  194. package/expertise/architecture/patterns/index.md +27 -0
  195. package/expertise/architecture/patterns/layered-architecture.md +736 -0
  196. package/expertise/architecture/patterns/microservices.md +753 -0
  197. package/expertise/architecture/patterns/modular-monolith.md +692 -0
  198. package/expertise/architecture/patterns/monolith.md +626 -0
  199. package/expertise/architecture/patterns/plugin-architecture.md +735 -0
  200. package/expertise/architecture/patterns/serverless.md +780 -0
  201. package/expertise/architecture/scaling/database-scaling.md +615 -0
  202. package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
  203. package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
  204. package/expertise/architecture/scaling/index.md +24 -0
  205. package/expertise/architecture/scaling/multi-tenancy.md +800 -0
  206. package/expertise/architecture/scaling/stateless-design.md +787 -0
  207. package/expertise/backend/embedded-firmware.md +625 -0
  208. package/expertise/backend/go.md +853 -0
  209. package/expertise/backend/index.md +24 -0
  210. package/expertise/backend/java-spring.md +448 -0
  211. package/expertise/backend/node-typescript.md +625 -0
  212. package/expertise/backend/python-fastapi.md +724 -0
  213. package/expertise/backend/rust.md +458 -0
  214. package/expertise/backend/solidity.md +711 -0
  215. package/expertise/composition-map.yaml +443 -0
  216. package/expertise/content/foundations/content-modeling.md +395 -0
  217. package/expertise/content/foundations/editorial-standards.md +449 -0
  218. package/expertise/content/foundations/index.md +24 -0
  219. package/expertise/content/foundations/microcopy.md +455 -0
  220. package/expertise/content/foundations/terminology-governance.md +509 -0
  221. package/expertise/content/index.md +34 -0
  222. package/expertise/content/patterns/accessibility-copy.md +518 -0
  223. package/expertise/content/patterns/index.md +24 -0
  224. package/expertise/content/patterns/notification-content.md +433 -0
  225. package/expertise/content/patterns/sample-content.md +486 -0
  226. package/expertise/content/patterns/state-copy.md +439 -0
  227. package/expertise/design/PROGRESS.md +58 -0
  228. package/expertise/design/disciplines/dark-mode-theming.md +577 -0
  229. package/expertise/design/disciplines/design-systems.md +595 -0
  230. package/expertise/design/disciplines/index.md +25 -0
  231. package/expertise/design/disciplines/information-architecture.md +800 -0
  232. package/expertise/design/disciplines/interaction-design.md +788 -0
  233. package/expertise/design/disciplines/responsive-design.md +552 -0
  234. package/expertise/design/disciplines/usability-testing.md +516 -0
  235. package/expertise/design/disciplines/user-research.md +792 -0
  236. package/expertise/design/foundations/accessibility-design.md +796 -0
  237. package/expertise/design/foundations/color-theory.md +797 -0
  238. package/expertise/design/foundations/iconography.md +795 -0
  239. package/expertise/design/foundations/index.md +26 -0
  240. package/expertise/design/foundations/motion-and-animation.md +653 -0
  241. package/expertise/design/foundations/rtl-design.md +585 -0
  242. package/expertise/design/foundations/spacing-and-layout.md +607 -0
  243. package/expertise/design/foundations/typography.md +800 -0
  244. package/expertise/design/foundations/visual-hierarchy.md +761 -0
  245. package/expertise/design/index.md +32 -0
  246. package/expertise/design/patterns/authentication-flows.md +474 -0
  247. package/expertise/design/patterns/content-consumption.md +789 -0
  248. package/expertise/design/patterns/data-display.md +618 -0
  249. package/expertise/design/patterns/e-commerce.md +1494 -0
  250. package/expertise/design/patterns/feedback-and-states.md +642 -0
  251. package/expertise/design/patterns/forms-and-input.md +819 -0
  252. package/expertise/design/patterns/gamification.md +801 -0
  253. package/expertise/design/patterns/index.md +31 -0
  254. package/expertise/design/patterns/microinteractions.md +449 -0
  255. package/expertise/design/patterns/navigation.md +800 -0
  256. package/expertise/design/patterns/notifications.md +705 -0
  257. package/expertise/design/patterns/onboarding.md +700 -0
  258. package/expertise/design/patterns/search-and-filter.md +601 -0
  259. package/expertise/design/patterns/settings-and-preferences.md +768 -0
  260. package/expertise/design/patterns/social-and-community.md +748 -0
  261. package/expertise/design/platforms/desktop-native.md +612 -0
  262. package/expertise/design/platforms/index.md +25 -0
  263. package/expertise/design/platforms/mobile-android.md +825 -0
  264. package/expertise/design/platforms/mobile-cross-platform.md +983 -0
  265. package/expertise/design/platforms/mobile-ios.md +699 -0
  266. package/expertise/design/platforms/tablet.md +794 -0
  267. package/expertise/design/platforms/web-dashboard.md +790 -0
  268. package/expertise/design/platforms/web-responsive.md +550 -0
  269. package/expertise/design/psychology/behavioral-nudges.md +449 -0
  270. package/expertise/design/psychology/cognitive-load.md +1191 -0
  271. package/expertise/design/psychology/error-psychology.md +778 -0
  272. package/expertise/design/psychology/index.md +22 -0
  273. package/expertise/design/psychology/persuasive-design.md +736 -0
  274. package/expertise/design/psychology/user-mental-models.md +623 -0
  275. package/expertise/design/tooling/open-pencil.md +266 -0
  276. package/expertise/frontend/angular.md +1073 -0
  277. package/expertise/frontend/desktop-electron.md +546 -0
  278. package/expertise/frontend/flutter.md +782 -0
  279. package/expertise/frontend/index.md +27 -0
  280. package/expertise/frontend/native-android.md +409 -0
  281. package/expertise/frontend/native-ios.md +490 -0
  282. package/expertise/frontend/react-native.md +1160 -0
  283. package/expertise/frontend/react.md +808 -0
  284. package/expertise/frontend/vue.md +1089 -0
  285. package/expertise/humanize/domain-rules-code.md +79 -0
  286. package/expertise/humanize/domain-rules-content.md +67 -0
  287. package/expertise/humanize/domain-rules-technical-docs.md +56 -0
  288. package/expertise/humanize/index.md +35 -0
  289. package/expertise/humanize/self-audit-checklist.md +87 -0
  290. package/expertise/humanize/sentence-patterns.md +218 -0
  291. package/expertise/humanize/vocabulary-blacklist.md +105 -0
  292. package/expertise/i18n/PROGRESS.md +65 -0
  293. package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
  294. package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
  295. package/expertise/i18n/advanced/complex-scripts.md +30 -0
  296. package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
  297. package/expertise/i18n/advanced/testing-i18n.md +28 -0
  298. package/expertise/i18n/content/content-adaptation.md +23 -0
  299. package/expertise/i18n/content/locale-specific-formatting.md +23 -0
  300. package/expertise/i18n/content/machine-translation-integration.md +28 -0
  301. package/expertise/i18n/content/translation-management.md +29 -0
  302. package/expertise/i18n/foundations/date-time-calendars.md +67 -0
  303. package/expertise/i18n/foundations/i18n-architecture.md +272 -0
  304. package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
  305. package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
  306. package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
  307. package/expertise/i18n/foundations/string-externalization.md +236 -0
  308. package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
  309. package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
  310. package/expertise/i18n/index.md +38 -0
  311. package/expertise/i18n/platform/backend-i18n.md +31 -0
  312. package/expertise/i18n/platform/flutter-i18n.md +148 -0
  313. package/expertise/i18n/platform/native-android-i18n.md +36 -0
  314. package/expertise/i18n/platform/native-ios-i18n.md +36 -0
  315. package/expertise/i18n/platform/react-i18n.md +103 -0
  316. package/expertise/i18n/platform/web-css-i18n.md +81 -0
  317. package/expertise/i18n/rtl/arabic-specific.md +175 -0
  318. package/expertise/i18n/rtl/hebrew-specific.md +149 -0
  319. package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
  320. package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
  321. package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
  322. package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
  323. package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
  324. package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
  325. package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
  326. package/expertise/i18n/rtl/rtl-typography.md +160 -0
  327. package/expertise/index.md +113 -0
  328. package/expertise/index.yaml +216 -0
  329. package/expertise/infrastructure/cloud-aws.md +597 -0
  330. package/expertise/infrastructure/cloud-gcp.md +599 -0
  331. package/expertise/infrastructure/cybersecurity.md +816 -0
  332. package/expertise/infrastructure/database-mongodb.md +447 -0
  333. package/expertise/infrastructure/database-postgres.md +400 -0
  334. package/expertise/infrastructure/devops-cicd.md +787 -0
  335. package/expertise/infrastructure/index.md +27 -0
  336. package/expertise/performance/PROGRESS.md +50 -0
  337. package/expertise/performance/backend/api-latency.md +1204 -0
  338. package/expertise/performance/backend/background-jobs.md +506 -0
  339. package/expertise/performance/backend/connection-pooling.md +1209 -0
  340. package/expertise/performance/backend/database-query-optimization.md +515 -0
  341. package/expertise/performance/backend/index.md +23 -0
  342. package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
  343. package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
  344. package/expertise/performance/foundations/caching-strategies.md +489 -0
  345. package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
  346. package/expertise/performance/foundations/index.md +24 -0
  347. package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
  348. package/expertise/performance/foundations/memory-management.md +964 -0
  349. package/expertise/performance/foundations/performance-budgets.md +1314 -0
  350. package/expertise/performance/index.md +31 -0
  351. package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
  352. package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
  353. package/expertise/performance/infrastructure/index.md +22 -0
  354. package/expertise/performance/infrastructure/load-balancing.md +1081 -0
  355. package/expertise/performance/infrastructure/observability.md +1079 -0
  356. package/expertise/performance/mobile/index.md +23 -0
  357. package/expertise/performance/mobile/mobile-animations.md +544 -0
  358. package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
  359. package/expertise/performance/mobile/mobile-network.md +452 -0
  360. package/expertise/performance/mobile/mobile-rendering.md +599 -0
  361. package/expertise/performance/mobile/mobile-startup-time.md +505 -0
  362. package/expertise/performance/platform-specific/flutter-performance.md +647 -0
  363. package/expertise/performance/platform-specific/index.md +22 -0
  364. package/expertise/performance/platform-specific/node-performance.md +1307 -0
  365. package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
  366. package/expertise/performance/platform-specific/react-performance.md +1403 -0
  367. package/expertise/performance/web/bundle-optimization.md +1239 -0
  368. package/expertise/performance/web/image-and-media.md +636 -0
  369. package/expertise/performance/web/index.md +24 -0
  370. package/expertise/performance/web/network-optimization.md +1133 -0
  371. package/expertise/performance/web/rendering-performance.md +1098 -0
  372. package/expertise/performance/web/ssr-and-hydration.md +918 -0
  373. package/expertise/performance/web/web-vitals.md +1374 -0
  374. package/expertise/quality/accessibility.md +985 -0
  375. package/expertise/quality/evidence-based-verification.md +499 -0
  376. package/expertise/quality/index.md +24 -0
  377. package/expertise/quality/ml-model-audit.md +614 -0
  378. package/expertise/quality/performance.md +600 -0
  379. package/expertise/quality/testing-api.md +891 -0
  380. package/expertise/quality/testing-mobile.md +496 -0
  381. package/expertise/quality/testing-web.md +849 -0
  382. package/expertise/security/PROGRESS.md +54 -0
  383. package/expertise/security/agentic-identity.md +540 -0
  384. package/expertise/security/compliance-frameworks.md +601 -0
  385. package/expertise/security/data/data-encryption.md +364 -0
  386. package/expertise/security/data/data-privacy-gdpr.md +692 -0
  387. package/expertise/security/data/database-security.md +1171 -0
  388. package/expertise/security/data/index.md +22 -0
  389. package/expertise/security/data/pii-handling.md +531 -0
  390. package/expertise/security/foundations/authentication.md +1041 -0
  391. package/expertise/security/foundations/authorization.md +603 -0
  392. package/expertise/security/foundations/cryptography.md +1001 -0
  393. package/expertise/security/foundations/index.md +25 -0
  394. package/expertise/security/foundations/owasp-top-10.md +1354 -0
  395. package/expertise/security/foundations/secrets-management.md +1217 -0
  396. package/expertise/security/foundations/secure-sdlc.md +700 -0
  397. package/expertise/security/foundations/supply-chain-security.md +698 -0
  398. package/expertise/security/index.md +31 -0
  399. package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
  400. package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
  401. package/expertise/security/infrastructure/container-security.md +721 -0
  402. package/expertise/security/infrastructure/incident-response.md +1295 -0
  403. package/expertise/security/infrastructure/index.md +24 -0
  404. package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
  405. package/expertise/security/infrastructure/network-security.md +1337 -0
  406. package/expertise/security/mobile/index.md +23 -0
  407. package/expertise/security/mobile/mobile-android-security.md +1218 -0
  408. package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
  409. package/expertise/security/mobile/mobile-data-storage.md +1265 -0
  410. package/expertise/security/mobile/mobile-ios-security.md +1401 -0
  411. package/expertise/security/mobile/mobile-network-security.md +1520 -0
  412. package/expertise/security/smart-contract-security.md +594 -0
  413. package/expertise/security/testing/index.md +22 -0
  414. package/expertise/security/testing/penetration-testing.md +1258 -0
  415. package/expertise/security/testing/security-code-review.md +1765 -0
  416. package/expertise/security/testing/threat-modeling.md +1074 -0
  417. package/expertise/security/testing/vulnerability-scanning.md +1062 -0
  418. package/expertise/security/web/api-security.md +586 -0
  419. package/expertise/security/web/cors-and-headers.md +433 -0
  420. package/expertise/security/web/csrf.md +562 -0
  421. package/expertise/security/web/file-upload.md +1477 -0
  422. package/expertise/security/web/index.md +25 -0
  423. package/expertise/security/web/injection.md +1375 -0
  424. package/expertise/security/web/session-management.md +1101 -0
  425. package/expertise/security/web/xss.md +1158 -0
  426. package/exports/README.md +17 -0
  427. package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
  428. package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
  429. package/exports/hosts/claude/.claude/agents/designer.md +55 -0
  430. package/exports/hosts/claude/.claude/agents/executor.md +55 -0
  431. package/exports/hosts/claude/.claude/agents/learner.md +51 -0
  432. package/exports/hosts/claude/.claude/agents/planner.md +53 -0
  433. package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
  434. package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
  435. package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
  436. package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
  437. package/exports/hosts/claude/.claude/commands/author.md +42 -0
  438. package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
  439. package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
  440. package/exports/hosts/claude/.claude/commands/design.md +44 -0
  441. package/exports/hosts/claude/.claude/commands/discover.md +37 -0
  442. package/exports/hosts/claude/.claude/commands/execute.md +48 -0
  443. package/exports/hosts/claude/.claude/commands/learn.md +38 -0
  444. package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
  445. package/exports/hosts/claude/.claude/commands/plan.md +39 -0
  446. package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
  447. package/exports/hosts/claude/.claude/commands/review.md +40 -0
  448. package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
  449. package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
  450. package/exports/hosts/claude/.claude/commands/specify.md +38 -0
  451. package/exports/hosts/claude/.claude/commands/verify.md +37 -0
  452. package/exports/hosts/claude/.claude/settings.json +34 -0
  453. package/exports/hosts/claude/CLAUDE.md +19 -0
  454. package/exports/hosts/claude/export.manifest.json +38 -0
  455. package/exports/hosts/claude/host-package.json +67 -0
  456. package/exports/hosts/codex/AGENTS.md +19 -0
  457. package/exports/hosts/codex/export.manifest.json +38 -0
  458. package/exports/hosts/codex/host-package.json +41 -0
  459. package/exports/hosts/cursor/.cursor/hooks.json +16 -0
  460. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
  461. package/exports/hosts/cursor/export.manifest.json +38 -0
  462. package/exports/hosts/cursor/host-package.json +42 -0
  463. package/exports/hosts/gemini/GEMINI.md +19 -0
  464. package/exports/hosts/gemini/export.manifest.json +38 -0
  465. package/exports/hosts/gemini/host-package.json +41 -0
  466. package/hooks/README.md +18 -0
  467. package/hooks/definitions/loop_cap_guard.yaml +21 -0
  468. package/hooks/definitions/post_tool_capture.yaml +24 -0
  469. package/hooks/definitions/pre_compact_summary.yaml +19 -0
  470. package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
  471. package/hooks/definitions/protected_path_write_guard.yaml +19 -0
  472. package/hooks/definitions/session_start.yaml +19 -0
  473. package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
  474. package/hooks/loop-cap-guard +17 -0
  475. package/hooks/post-tool-lint +36 -0
  476. package/hooks/protected-path-write-guard +17 -0
  477. package/hooks/session-start +41 -0
  478. package/llms-full.txt +2355 -0
  479. package/llms.txt +43 -0
  480. package/package.json +79 -0
  481. package/roles/README.md +20 -0
  482. package/roles/clarifier.md +42 -0
  483. package/roles/content-author.md +63 -0
  484. package/roles/designer.md +55 -0
  485. package/roles/executor.md +55 -0
  486. package/roles/learner.md +51 -0
  487. package/roles/planner.md +53 -0
  488. package/roles/researcher.md +43 -0
  489. package/roles/reviewer.md +54 -0
  490. package/roles/specifier.md +47 -0
  491. package/roles/verifier.md +71 -0
  492. package/schemas/README.md +24 -0
  493. package/schemas/accepted-learning.schema.json +20 -0
  494. package/schemas/author-artifact.schema.json +156 -0
  495. package/schemas/clarification.schema.json +19 -0
  496. package/schemas/design-artifact.schema.json +80 -0
  497. package/schemas/docs-claim.schema.json +18 -0
  498. package/schemas/export-manifest.schema.json +20 -0
  499. package/schemas/hook.schema.json +67 -0
  500. package/schemas/host-export-package.schema.json +18 -0
  501. package/schemas/implementation-plan.schema.json +19 -0
  502. package/schemas/proposed-learning.schema.json +19 -0
  503. package/schemas/research.schema.json +18 -0
  504. package/schemas/review.schema.json +29 -0
  505. package/schemas/run-manifest.schema.json +18 -0
  506. package/schemas/spec-challenge.schema.json +18 -0
  507. package/schemas/spec.schema.json +20 -0
  508. package/schemas/usage.schema.json +102 -0
  509. package/schemas/verification-proof.schema.json +29 -0
  510. package/schemas/wazir-manifest.schema.json +173 -0
  511. package/skills/README.md +40 -0
  512. package/skills/brainstorming/SKILL.md +77 -0
  513. package/skills/debugging/SKILL.md +50 -0
  514. package/skills/design/SKILL.md +61 -0
  515. package/skills/dispatching-parallel-agents/SKILL.md +128 -0
  516. package/skills/executing-plans/SKILL.md +70 -0
  517. package/skills/finishing-a-development-branch/SKILL.md +169 -0
  518. package/skills/humanize/SKILL.md +123 -0
  519. package/skills/init-pipeline/SKILL.md +124 -0
  520. package/skills/prepare-next/SKILL.md +20 -0
  521. package/skills/receiving-code-review/SKILL.md +123 -0
  522. package/skills/requesting-code-review/SKILL.md +105 -0
  523. package/skills/requesting-code-review/code-reviewer.md +108 -0
  524. package/skills/run-audit/SKILL.md +197 -0
  525. package/skills/scan-project/SKILL.md +41 -0
  526. package/skills/self-audit/SKILL.md +153 -0
  527. package/skills/subagent-driven-development/SKILL.md +154 -0
  528. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  529. package/skills/subagent-driven-development/implementer-prompt.md +102 -0
  530. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  531. package/skills/tdd/SKILL.md +23 -0
  532. package/skills/using-git-worktrees/SKILL.md +163 -0
  533. package/skills/using-skills/SKILL.md +95 -0
  534. package/skills/verification/SKILL.md +22 -0
  535. package/skills/wazir/SKILL.md +463 -0
  536. package/skills/writing-plans/SKILL.md +30 -0
  537. package/skills/writing-skills/SKILL.md +157 -0
  538. package/skills/writing-skills/anthropic-best-practices.md +122 -0
  539. package/skills/writing-skills/persuasion-principles.md +50 -0
  540. package/templates/README.md +20 -0
  541. package/templates/artifacts/README.md +10 -0
  542. package/templates/artifacts/accepted-learning.md +19 -0
  543. package/templates/artifacts/accepted-learning.template.json +12 -0
  544. package/templates/artifacts/author.md +74 -0
  545. package/templates/artifacts/author.template.json +19 -0
  546. package/templates/artifacts/clarification.md +21 -0
  547. package/templates/artifacts/clarification.template.json +12 -0
  548. package/templates/artifacts/execute-notes.md +19 -0
  549. package/templates/artifacts/implementation-plan.md +21 -0
  550. package/templates/artifacts/implementation-plan.template.json +11 -0
  551. package/templates/artifacts/learning-proposal.md +19 -0
  552. package/templates/artifacts/next-run-handoff.md +21 -0
  553. package/templates/artifacts/plan-review.md +19 -0
  554. package/templates/artifacts/proposed-learning.template.json +12 -0
  555. package/templates/artifacts/research.md +21 -0
  556. package/templates/artifacts/research.template.json +12 -0
  557. package/templates/artifacts/review-findings.md +19 -0
  558. package/templates/artifacts/review.template.json +11 -0
  559. package/templates/artifacts/run-manifest.template.json +8 -0
  560. package/templates/artifacts/spec-challenge.md +19 -0
  561. package/templates/artifacts/spec-challenge.template.json +11 -0
  562. package/templates/artifacts/spec.md +21 -0
  563. package/templates/artifacts/spec.template.json +12 -0
  564. package/templates/artifacts/verification-proof.md +19 -0
  565. package/templates/artifacts/verification-proof.template.json +11 -0
  566. package/templates/examples/accepted-learning.example.json +14 -0
  567. package/templates/examples/author.example.json +152 -0
  568. package/templates/examples/clarification.example.json +15 -0
  569. package/templates/examples/docs-claim.example.json +8 -0
  570. package/templates/examples/export-manifest.example.json +7 -0
  571. package/templates/examples/host-export-package.example.json +11 -0
  572. package/templates/examples/implementation-plan.example.json +17 -0
  573. package/templates/examples/proposed-learning.example.json +13 -0
  574. package/templates/examples/research.example.json +15 -0
  575. package/templates/examples/research.example.md +6 -0
  576. package/templates/examples/review.example.json +17 -0
  577. package/templates/examples/run-manifest.example.json +9 -0
  578. package/templates/examples/spec-challenge.example.json +14 -0
  579. package/templates/examples/spec.example.json +21 -0
  580. package/templates/examples/verification-proof.example.json +21 -0
  581. package/templates/examples/wazir-manifest.example.yaml +65 -0
  582. package/templates/task-definition-schema.md +99 -0
  583. package/tooling/README.md +20 -0
  584. package/tooling/src/adapters/context-mode.js +50 -0
  585. package/tooling/src/capture/command.js +376 -0
  586. package/tooling/src/capture/store.js +99 -0
  587. package/tooling/src/capture/usage.js +270 -0
  588. package/tooling/src/checks/branches.js +50 -0
  589. package/tooling/src/checks/brand-truth.js +110 -0
  590. package/tooling/src/checks/changelog.js +231 -0
  591. package/tooling/src/checks/command-registry.js +36 -0
  592. package/tooling/src/checks/commits.js +102 -0
  593. package/tooling/src/checks/docs-drift.js +103 -0
  594. package/tooling/src/checks/docs-truth.js +201 -0
  595. package/tooling/src/checks/runtime-surface.js +156 -0
  596. package/tooling/src/cli.js +116 -0
  597. package/tooling/src/command-options.js +56 -0
  598. package/tooling/src/commands/validate.js +320 -0
  599. package/tooling/src/doctor/command.js +91 -0
  600. package/tooling/src/export/command.js +77 -0
  601. package/tooling/src/export/compiler.js +498 -0
  602. package/tooling/src/guards/loop-cap-guard.js +52 -0
  603. package/tooling/src/guards/protected-path-write-guard.js +67 -0
  604. package/tooling/src/index/command.js +152 -0
  605. package/tooling/src/index/storage.js +1061 -0
  606. package/tooling/src/index/summarizers.js +261 -0
  607. package/tooling/src/loaders.js +18 -0
  608. package/tooling/src/project-root.js +22 -0
  609. package/tooling/src/recall/command.js +225 -0
  610. package/tooling/src/schema-validator.js +30 -0
  611. package/tooling/src/state-root.js +40 -0
  612. package/tooling/src/status/command.js +71 -0
  613. package/wazir.manifest.yaml +135 -0
  614. package/workflows/README.md +19 -0
  615. package/workflows/author.md +42 -0
  616. package/workflows/clarify.md +38 -0
  617. package/workflows/design-review.md +46 -0
  618. package/workflows/design.md +44 -0
  619. package/workflows/discover.md +37 -0
  620. package/workflows/execute.md +48 -0
  621. package/workflows/learn.md +38 -0
  622. package/workflows/plan-review.md +42 -0
  623. package/workflows/plan.md +39 -0
  624. package/workflows/prepare-next.md +37 -0
  625. package/workflows/review.md +40 -0
  626. package/workflows/run-audit.md +41 -0
  627. package/workflows/spec-challenge.md +41 -0
  628. package/workflows/specify.md +38 -0
  629. package/workflows/verify.md +37 -0
@@ -0,0 +1,1295 @@
1
+ # Incident Response
2
+
3
+ > Expertise module for AI agents -- use during planning and implementation to build
4
+ > and execute incident response capabilities. Effective IR reduces breach cost by
5
+ > 58% (IBM 2024) and is required by NIST CSF 2.0, GDPR, PCI-DSS, SOC 2, and
6
+ > cyber insurance policies.
7
+
8
+ ---
9
+
10
+ ## 1. Threat Landscape
11
+
12
+ ### 1.1 Breach Cost Reality
13
+
14
+ The financial impact of security incidents continues to escalate. Organizations
15
+ without mature IR programs absorb significantly higher costs and longer recovery
16
+ times.
17
+
18
+ | Metric | 2023 | 2024 | 2025 | Source |
19
+ |---|---|---|---|---|
20
+ | Global average breach cost | $4.45M | $4.88M | $4.44M | IBM Cost of a Data Breach |
21
+ | US average breach cost | $9.48M | $9.36M | $10.22M | IBM Cost of a Data Breach |
22
+ | Healthcare sector average | $10.93M | $9.77M | -- | IBM Cost of a Data Breach |
23
+ | Cost with IR plan + testing | $3.26M | $3.28M | -- | IBM Cost of a Data Breach |
24
+ | Cost without IR plan | $5.71M | $5.72M | -- | IBM Cost of a Data Breach |
25
+ | Average savings from IR team | $2.66M | $2.44M | -- | IBM Cost of a Data Breach |
26
+
27
+ Key cost drivers:
28
+ - **Shadow AI**: Unapproved AI tool usage adds $670K to average breach cost (IBM 2025)
29
+ - **Multi-environment breaches**: Average $5M+ and 283 days to contain (IBM 2024)
30
+ - **Regulatory fines**: GDPR fines up to 4% of global annual revenue
31
+ - **Ransomware payments**: Median payment $200K; total cost including recovery averages $4.54M
32
+
33
+ ### 1.2 Dwell Time Statistics
34
+
35
+ Dwell time -- the period between initial compromise and detection -- directly
36
+ correlates with damage severity.
37
+
38
+ | Detection Method | Median Dwell Time (2024) | Source |
39
+ |---|---|---|
40
+ | Internal detection | 10 days | Mandiant M-Trends 2025 |
41
+ | External notification | 26 days | Mandiant M-Trends 2025 |
42
+ | Adversary notification (ransom) | 5 days | Mandiant M-Trends 2025 |
43
+ | Ransomware (IR cases, 2025) | 4-5 days | Sophos Active Adversary |
44
+ | Non-ransomware (IR cases, 2025) | 11-13 days | Sophos Active Adversary |
45
+ | MDR-managed environments | 1-3 days | Sophos Active Adversary |
46
+
47
+ Trend: Attackers are compressing their timelines. Ransomware operators now
48
+ routinely move from initial access to encryption within 24-48 hours, down from
49
+ 5+ days in 2022. This makes automated detection and response essential.
50
+
51
+ ### 1.3 Regulatory Notification Deadlines
52
+
53
+ | Regulation | Notification Window | Recipient | Penalty |
54
+ |---|---|---|---|
55
+ | GDPR (EU) | 72 hours from awareness | Supervisory Authority | Up to 4% global revenue or EUR 20M |
56
+ | CISA/CIRCIA (US) | 72 hours (incidents), 24 hours (ransom payments) | CISA | Administrative penalties |
57
+ | PCI-DSS | 72 hours (MasterCard); varies by brand | Card brands + acquirer | Fines $5K-$100K/month |
58
+ | HIPAA (US) | 60 days (>500 records), annual (fewer) | HHS OCR | $100-$50K per violation |
59
+ | SEC (US public companies) | 4 business days (material incidents) | SEC via 8-K filing | Securities enforcement |
60
+ | NIS2 (EU) | 24 hours (early warning), 72 hours (full) | National CSIRT | Up to EUR 10M or 2% revenue |
61
+ | State breach laws (US) | 30-90 days (varies by state) | State AG + affected individuals | Varies |
62
+
63
+ ### 1.4 Cyber Insurance Requirements
64
+
65
+ Insurers increasingly mandate IR readiness as a coverage prerequisite:
66
+
67
+ - **Documented IR plan** -- Must cover detection, containment, eradication, recovery
68
+ - **Annual IR plan testing** -- Tabletop exercises or simulations at minimum
69
+ - **Ransomware-specific playbook** -- Separate from general IR plan
70
+ - **24/7 detection capability** -- EDR, MDR, or SOC coverage
71
+ - **MFA enforcement** -- Required on all privileged and remote access
72
+ - **Encrypted offline backups** -- Tested and verified recovery capability
73
+ - **Immediate insurer notification** -- Policy often requires notification within hours
74
+ - **Forensic retainer** -- Pre-arranged relationship with approved forensic vendors
75
+
76
+ CRITICAL: Failure to maintain these controls can void coverage. Many policies
77
+ include "failure to maintain" clauses that deny claims if controls lapsed before
78
+ the incident.
79
+
80
+ ---
81
+
82
+ ## 2. Core Security Principles
83
+
84
+ ### 2.1 NIST IR Lifecycle (SP 800-61 Rev. 3)
85
+
86
+ NIST SP 800-61 Revision 3 (April 2025) restructured the IR lifecycle to align
87
+ with the Cybersecurity Framework 2.0 six functions. The traditional four-phase
88
+ model maps into this broader framework:
89
+
90
+ ```
91
+ CSF 2.0 Mapping:
92
+
93
+ GOVERN -----> IR Program Management, Policy, Roles
94
+ IDENTIFY ---> Asset Inventory, Risk Assessment, Threat Intelligence
95
+ PROTECT ----> Preventive Controls, Training, Access Management
96
+ DETECT -----> Monitoring, Alert Triage, Indicator Analysis
97
+ RESPOND ----> Containment, Eradication, Communication, Forensics
98
+ RECOVER ----> Service Restoration, Lessons Learned, Plan Updates
99
+
100
+ Traditional Four-Phase Model (Rev. 2, still valid conceptually):
101
+
102
+ 1. Preparation
103
+ |
104
+ 2. Detection & Analysis
105
+ |
106
+ 3. Containment, Eradication & Recovery
107
+ |
108
+ 4. Post-Incident Activity
109
+ |
110
+ +---> feeds back to Preparation
111
+ ```
112
+
113
+ ### 2.2 Incident Classification and Severity Levels
114
+
115
+ Define severity levels BEFORE an incident occurs. Use a consistent taxonomy
116
+ across all playbooks.
117
+
118
+ | Severity | Label | Description | Response SLA | Escalation |
119
+ |---|---|---|---|---|
120
+ | SEV-1 | Critical | Active data exfiltration, ransomware spreading, production down | 15 min initial response | CISO, CEO, Legal, Board |
121
+ | SEV-2 | High | Confirmed compromise, lateral movement detected, sensitive data exposed | 30 min initial response | CISO, VP Engineering, Legal |
122
+ | SEV-3 | Medium | Suspicious activity confirmed, single system compromised, no spread | 2 hours initial response | Security Lead, IT Manager |
123
+ | SEV-4 | Low | Policy violation, failed attack attempt, single phishing click (no exec) | 8 hours initial response | SOC Analyst, Team Lead |
124
+ | SEV-5 | Informational | Vulnerability disclosure, threat intel alert, false positive | Next business day | SOC Analyst |
125
+
126
+ Severity can ONLY escalate during an incident, never downgrade until post-incident
127
+ review confirms reduced scope.
128
+
129
+ ### 2.3 Communication Plans
130
+
131
+ Establish communication channels and authority BEFORE an incident:
132
+
133
+ ```
134
+ Communication Matrix:
135
+
136
+ Internal:
137
+ - War room channel (Slack/Teams) -- created per-incident, invite-only
138
+ - Bridge call number -- always-available conference line
139
+ - Status cadence -- every 30 min (SEV-1), every 2 hours (SEV-2)
140
+ - Stakeholder updates -- executive summary every 4 hours (SEV-1/2)
141
+
142
+ External:
143
+ - Legal counsel -- engaged immediately for SEV-1/2
144
+ - Cyber insurance -- notify within policy-required window
145
+ - Law enforcement -- FBI IC3, local field office for criminal activity
146
+ - Regulators -- per notification deadline table above
147
+ - Customers -- only after legal review, coordinated messaging
148
+ - Media -- only through designated spokesperson, prepared statement
149
+
150
+ Rules:
151
+ - NO public disclosure without legal approval
152
+ - NO technical details in external communications
153
+ - ALL external communications reviewed by legal before release
154
+ - Document every communication with timestamp and recipient
155
+ ```
156
+
157
+ ### 2.4 Chain of Custody for Digital Forensics
158
+
159
+ Evidence handling must withstand legal scrutiny. Any break in chain of custody
160
+ renders evidence inadmissible.
161
+
162
+ Requirements:
163
+ 1. **Document acquisition** -- Who collected what, when, from where, using what tool
164
+ 2. **Cryptographic hashing** -- SHA-256 hash of all evidence at time of collection
165
+ 3. **Write protection** -- Use write blockers for disk imaging; read-only mounts
166
+ 4. **Secure storage** -- Evidence stored in access-controlled, tamper-evident storage
167
+ 5. **Access log** -- Every access to evidence documented with purpose and authorization
168
+ 6. **Continuous integrity** -- Re-verify hashes before and after any analysis
169
+ 7. **Chain documentation** -- Transfer of custody forms signed by both parties
170
+
171
+ ```
172
+ Evidence Tag Template:
173
+
174
+ Case ID: _______________
175
+ Evidence ID: _______________
176
+ Date/Time: _______________
177
+ Collected By: _______________
178
+ Description: _______________
179
+ Source Device: _______________
180
+ Serial Number: _______________
181
+ SHA-256 Hash: _______________
182
+ Storage Location: _____________
183
+ Chain of Custody:
184
+ From: _______ To: _______ Date: _______ Purpose: _______
185
+ ```
186
+
187
+ ---
188
+
189
+ ## 3. Implementation Patterns
190
+
191
+ ### 3.1 IR Plan Template Structure
192
+
193
+ Every organization needs a written, tested, and maintained IR plan:
194
+
195
+ ```
196
+ Incident Response Plan -- Table of Contents
197
+
198
+ 1. Purpose and Scope
199
+ 2. Definitions and Terminology
200
+ 3. Roles and Responsibilities
201
+ 3.1 IR Team (CSIRT) composition
202
+ 3.2 Executive sponsors
203
+ 3.3 External partners (forensics, legal, PR)
204
+ 4. Incident Classification Taxonomy
205
+ 5. Detection and Reporting Procedures
206
+ 6. Severity Assessment Matrix
207
+ 7. Escalation Procedures
208
+ 8. Containment Strategies
209
+ 8.1 Network isolation procedures
210
+ 8.2 Account lockout procedures
211
+ 8.3 Service shutdown procedures
212
+ 9. Evidence Collection and Preservation
213
+ 10. Eradication Procedures
214
+ 11. Recovery Procedures
215
+ 12. Communication Plans
216
+ 12.1 Internal communication templates
217
+ 12.2 Customer notification templates
218
+ 12.3 Regulatory notification templates
219
+ 12.4 Media statement templates
220
+ 13. Post-Incident Review Process
221
+ 14. Plan Maintenance Schedule
222
+ 15. Appendices
223
+ A. Contact lists (internal + external)
224
+ B. Network diagrams
225
+ C. System inventory
226
+ D. Playbook index
227
+ ```
228
+
229
+ ### 3.2 Containment Strategies
230
+
231
+ Select containment based on incident type and severity. Always prefer reversible
232
+ actions when possible.
233
+
234
+ | Strategy | When to Use | Reversibility | Risk |
235
+ |---|---|---|---|
236
+ | **Network segment isolation** | Lateral movement detected | High | May disrupt dependent services |
237
+ | **Host firewall rules** | Single compromised host | High | Attacker may detect and accelerate |
238
+ | **VLAN quarantine** | Multiple hosts in same segment | High | Requires network team coordination |
239
+ | **Account lockout** | Compromised credentials | Medium | May lock out legitimate users |
240
+ | **Service shutdown** | Compromised application | Low | Direct business impact |
241
+ | **DNS sinkhole** | C2 communication detected | High | May not catch all C2 channels |
242
+ | **Full network disconnect** | Active ransomware spreading | Low | Maximum disruption, last resort |
243
+ | **Cloud security group** | Cloud workload compromise | High | Fast; API-driven |
244
+
245
+ ### 3.3 Escalation Procedures
246
+
247
+ ```
248
+ Escalation Flow:
249
+
250
+ Alert Triggered
251
+ |
252
+ v
253
+ SOC Analyst (L1) -- 15 min triage
254
+ |-- False positive --> Close with documentation
255
+ |-- Confirmed --> Assign severity
256
+ |
257
+ v
258
+ IR Lead (L2) -- Validate severity, begin investigation
259
+ |-- SEV-4/5 --> IR Lead manages to resolution
260
+ |-- SEV-3 --> IR Lead + relevant team
261
+ |-- SEV-1/2 --> Activate full IR team
262
+ |
263
+ v
264
+ CSIRT Activation -- War room, roles assigned
265
+ |-- SEV-1 --> Notify CISO within 15 min
266
+ | Notify CEO within 30 min
267
+ | Engage legal counsel
268
+ | Activate forensic retainer
269
+ | Notify cyber insurance carrier
270
+ |
271
+ Ongoing: Status updates per communication cadence
272
+ ```
273
+
274
+ ### 3.4 Post-Incident Review Process
275
+
276
+ Conduct a blameless post-incident review (PIR) within 5 business days of
277
+ incident closure. Focus on process improvement, not individual fault.
278
+
279
+ PIR Agenda:
280
+ 1. **Timeline reconstruction** -- Minute-by-minute from detection to resolution
281
+ 2. **Root cause analysis** -- What allowed the incident to occur
282
+ 3. **Detection effectiveness** -- How was it found? How could it be found faster?
283
+ 4. **Response effectiveness** -- What worked? What didn't? Where were delays?
284
+ 5. **Communication assessment** -- Were stakeholders informed appropriately?
285
+ 6. **Control gap identification** -- What preventive controls were missing or failed?
286
+ 7. **Action items** -- Specific, assigned, time-bound improvements
287
+ 8. **Metrics update** -- Update MTTD, MTTR, incident count dashboards
288
+
289
+ ### 3.5 Tabletop Exercise Design
290
+
291
+ Run tabletop exercises at least quarterly. Vary scenarios and participants.
292
+
293
+ ```
294
+ Tabletop Exercise Structure (90-120 minutes):
295
+
296
+ Pre-Exercise (1 week before):
297
+ - Distribute scenario overview (not details)
298
+ - Confirm participants and roles
299
+ - Prepare injects (escalation points)
300
+
301
+ Exercise Flow:
302
+ Phase 1: Initial Detection (20 min)
303
+ - Present scenario trigger
304
+ - Teams discuss: What do we do first?
305
+ Phase 2: Escalation (20 min)
306
+ - Inject: situation worsens
307
+ - Teams discuss: containment decisions
308
+ Phase 3: Stakeholder Management (20 min)
309
+ - Inject: media inquiry, customer calls
310
+ - Teams discuss: communication approach
311
+ Phase 4: Recovery (15 min)
312
+ - Teams discuss: eradication + recovery steps
313
+ Phase 5: Debrief (15-25 min)
314
+ - What went well? What gaps emerged?
315
+ - Action items assigned
316
+
317
+ Document: Findings report within 1 week
318
+ Track: Action item completion
319
+ ```
320
+
321
+ ---
322
+
323
+ ## 4. Vulnerability Catalog -- Incident Scenarios and Response Playbooks
324
+
325
+ ### 4.1 Ransomware
326
+
327
+ **Attack Chain**: Phishing/RDP exploit -> credential theft -> lateral movement ->
328
+ domain admin compromise -> disable backups -> deploy encryption
329
+
330
+ **Detection Indicators**:
331
+ - Mass file rename operations (entropy change in file extensions)
332
+ - Volume Shadow Copy deletion (`vssadmin delete shadows`)
333
+ - Anomalous SMB traffic patterns across multiple hosts
334
+ - EDR alerts for known ransomware behaviors
335
+ - Canary file modifications (honeypot files placed in shares)
336
+
337
+ **Containment**:
338
+ 1. Immediately isolate affected systems from network (do NOT power off)
339
+ 2. Disable all privileged accounts except designated IR admin accounts
340
+ 3. Block lateral movement: disable SMB, RDP, WinRM between segments
341
+ 4. Preserve at least one encrypted system for forensic analysis
342
+ 5. Identify patient zero and attack vector
343
+
344
+ **Recovery**: Restore from verified clean backups. Rebuild domain controllers
345
+ if AD was compromised. Reset ALL credentials. Verify backup integrity before
346
+ restoration. Monitor for re-infection indicators for 90 days.
347
+
348
+ **Decision: Pay or not pay ransom?** -- Engage legal counsel, law enforcement
349
+ (FBI), and cyber insurance carrier. Payment does NOT guarantee recovery; only
350
+ 65% of organizations that paid recovered all data (Sophos 2024). Payment may
351
+ violate OFAC sanctions.
352
+
353
+ ### 4.2 Data Breach / Data Exfiltration
354
+
355
+ **Attack Chain**: Initial access -> reconnaissance -> privilege escalation ->
356
+ data staging -> compression/encryption -> exfiltration via HTTPS/DNS/cloud storage
357
+
358
+ **Detection Indicators**:
359
+ - Unusual outbound data volume (DLP alerts)
360
+ - Large archive files created on servers
361
+ - DNS tunneling patterns (high query volume, long subdomain names)
362
+ - Unauthorized cloud storage access (Google Drive, Dropbox, Mega)
363
+ - Database query anomalies (bulk SELECT, pg_dump, mysqldump)
364
+
365
+ **Containment**:
366
+ 1. Block identified exfiltration channels (IPs, domains, protocols)
367
+ 2. Revoke compromised credentials
368
+ 3. Enable enhanced logging on data stores
369
+ 4. Assess scope: what data, how much, how sensitive
370
+ 5. Engage legal for notification obligation assessment
371
+
372
+ **Recovery**: Determine regulatory notification requirements based on data
373
+ type and jurisdiction. Prepare notification letters. Offer credit monitoring
374
+ if PII involved. Implement DLP controls to prevent recurrence.
375
+
376
+ ### 4.3 Business Email Compromise (BEC) / Account Compromise
377
+
378
+ **Attack Chain**: Credential phishing -> mailbox access -> inbox rule creation
379
+ (hide evidence) -> reconnaissance of financial workflows -> impersonation of
380
+ executive -> fraudulent wire transfer request
381
+
382
+ **Detection Indicators**:
383
+ - Impossible travel alerts (login from two distant locations)
384
+ - New inbox rules forwarding to external addresses
385
+ - OAuth app consent from unfamiliar applications
386
+ - MFA bypass or enrollment of new MFA device
387
+ - Password spray patterns against Azure AD/Entra ID
388
+
389
+ **Containment**:
390
+ 1. Force password reset and revoke all sessions/tokens
391
+ 2. Remove malicious inbox rules and OAuth app consents
392
+ 3. Enable conditional access policies (block risky sign-ins)
393
+ 4. Review sent items for impersonation emails
394
+ 5. Contact financial institutions to freeze fraudulent transfers (time-critical)
395
+
396
+ ### 4.4 Distributed Denial of Service (DDoS)
397
+
398
+ **Detection Indicators**:
399
+ - Sudden traffic spike exceeding baseline by 10x+
400
+ - Geo-anomalous traffic sources
401
+ - SYN flood, UDP amplification, or HTTP flood patterns
402
+ - CDN/WAF alerts for volumetric attacks
403
+
404
+ **Containment**:
405
+ 1. Activate DDoS mitigation service (Cloudflare, AWS Shield, Akamai)
406
+ 2. Implement rate limiting and geo-blocking if attack source is concentrated
407
+ 3. Enable upstream provider scrubbing
408
+ 4. Scale infrastructure if cloud-based (auto-scaling groups)
409
+ 5. Communicate service degradation to customers
410
+
411
+ ### 4.5 Insider Threat
412
+
413
+ **Detection Indicators**:
414
+ - Access to resources outside normal job function
415
+ - Bulk data downloads before resignation/termination date
416
+ - USB device usage on sensitive systems
417
+ - After-hours access to critical systems
418
+ - UEBA behavioral anomaly alerts
419
+
420
+ **Containment**:
421
+ 1. Coordinate with HR and legal BEFORE confronting the individual
422
+ 2. Preserve evidence: email, file access logs, badge access records
423
+ 3. Disable access in coordination with HR action (simultaneous)
424
+ 4. Image workstation and mobile devices
425
+ 5. Review access to all systems in the 90 days prior to detection
426
+
427
+ ### 4.6 Supply Chain Compromise
428
+
429
+ **Real-World Examples**: SolarWinds Orion (2020), Codecov bash uploader (2021),
430
+ 3CX Desktop App (2023), xz-utils backdoor (2024)
431
+
432
+ **Detection Indicators**:
433
+ - Unexpected outbound connections from trusted software
434
+ - Hash mismatch between vendor-published and installed binaries
435
+ - Anomalous behavior from recently updated trusted applications
436
+ - Threat intelligence alerts on vendor compromises
437
+
438
+ **Containment**:
439
+ 1. Identify all instances of the compromised software/component
440
+ 2. Isolate affected systems from network
441
+ 3. Block C2 indicators (IPs, domains) at perimeter
442
+ 4. Assess downstream impact (did compromised software access secrets/data?)
443
+ 5. Engage vendor for IOCs, patches, and coordinated response
444
+
445
+ ### 4.7 Web Application Attack (SQLi, RCE, SSRF)
446
+
447
+ **Detection Indicators**:
448
+ - WAF alerts for injection patterns
449
+ - Unusual process spawning from web server (webshell)
450
+ - Database errors in application logs
451
+ - SSRF-pattern requests to cloud metadata endpoints (169.254.169.254)
452
+
453
+ **Containment**:
454
+ 1. Block attacking IPs at WAF/firewall
455
+ 2. Take vulnerable endpoint offline or deploy virtual patch
456
+ 3. Check for webshells in web root directories
457
+ 4. Rotate database credentials and API keys accessed by the application
458
+ 5. Review database for data tampering or exfiltration
459
+
460
+ ### 4.8 Cloud Infrastructure Compromise
461
+
462
+ **Detection Indicators**:
463
+ - GuardDuty/SCC alerts for anomalous API calls
464
+ - New IAM users or roles created outside change management
465
+ - EC2 instances launched in unusual regions
466
+ - S3 bucket policies modified to allow public access
467
+ - CloudTrail logging disabled or modified
468
+
469
+ **Containment**:
470
+ 1. Disable compromised IAM credentials (do NOT delete -- preserve for forensics)
471
+ 2. Apply restrictive security group/network ACLs to affected resources
472
+ 3. Snapshot affected EC2 instances for forensic analysis
473
+ 4. Revoke temporary credentials and rotate long-term keys
474
+ 5. Review CloudTrail for full scope of attacker activity
475
+
476
+ ### 4.9 Phishing Campaign (Targeted)
477
+
478
+ **Detection Indicators**:
479
+ - Multiple users reporting similar suspicious emails
480
+ - Email gateway alerts for malicious attachments/links
481
+ - Spike in credential page visits from email links
482
+ - Sandbox detonation alerts for malicious payloads
483
+
484
+ **Containment**:
485
+ 1. Search and purge malicious emails from all mailboxes (admin search)
486
+ 2. Block sender domain/IP at email gateway
487
+ 3. Block phishing URLs at proxy/DNS
488
+ 4. Identify users who clicked -- force password reset
489
+ 5. Check for post-compromise activity on clicked-user accounts
490
+
491
+ ### 4.10 Malware Outbreak
492
+
493
+ **Detection Indicators**:
494
+ - EDR alerts on multiple endpoints simultaneously
495
+ - Signature or behavioral detection of known malware families
496
+ - Anomalous network beaconing patterns (regular interval callbacks)
497
+ - Unexpected processes, services, or scheduled tasks
498
+
499
+ **Containment**:
500
+ 1. Isolate affected endpoints via EDR network isolation feature
501
+ 2. Identify malware family and propagation mechanism
502
+ 3. Block C2 infrastructure at firewall and DNS
503
+ 4. Deploy IOCs to all endpoints for immediate scanning
504
+ 5. Identify initial infection vector to prevent re-infection
505
+
506
+ ### 4.11 Cryptomining / Resource Hijacking
507
+
508
+ **Detection Indicators**:
509
+ - Sustained high CPU/GPU utilization on servers or cloud instances
510
+ - Connections to known mining pool domains/IPs
511
+ - Unexpected large cloud compute bills
512
+ - New containers or Lambda functions not in deployment pipeline
513
+
514
+ **Containment**:
515
+ 1. Terminate unauthorized compute workloads
516
+ 2. Revoke compromised cloud credentials
517
+ 3. Block mining pool connections at network level
518
+ 4. Review infrastructure-as-code for unauthorized modifications
519
+
520
+ ### 4.12 Zero-Day Exploitation
521
+
522
+ **Detection Indicators**:
523
+ - Threat intelligence alerts for newly disclosed CVE
524
+ - Anomalous behavior from patched/current software
525
+ - Exploit attempts matching published PoC patterns
526
+ - Vendor emergency advisory
527
+
528
+ **Containment**:
529
+ 1. Apply vendor mitigations or workarounds immediately
530
+ 2. Implement virtual patching via WAF/IPS rules
531
+ 3. Increase monitoring on affected systems
532
+ 4. Assess exposure: how many instances, internet-facing?
533
+ 5. Patch as soon as vendor releases fix; prioritize internet-facing systems
534
+
535
+ ---
536
+
537
+ ## 5. Security Checklist
538
+
539
+ ### Preparation Phase
540
+
541
+ - [ ] Written IR plan approved by CISO and legal counsel
542
+ - [ ] CSIRT team defined with roles, backups, and contact info
543
+ - [ ] Severity classification matrix documented and distributed
544
+ - [ ] Communication templates pre-approved by legal (internal, customer, regulatory, media)
545
+ - [ ] Forensic retainer agreement in place with qualified vendor
546
+ - [ ] Cyber insurance policy reviewed; notification requirements documented
547
+ - [ ] IR tooling deployed: SIEM, EDR, forensic tools, communication channels
548
+ - [ ] Evidence storage solution configured (write-once, access-controlled)
549
+ - [ ] Tabletop exercises conducted quarterly with documented findings
550
+ - [ ] Asset inventory current and accessible during incident
551
+ - [ ] Network diagrams and data flow diagrams current
552
+ - [ ] Playbooks written for top 10 incident scenarios
553
+
554
+ ### Detection Phase
555
+
556
+ - [ ] 24/7 monitoring coverage (SOC, MDR, or on-call rotation)
557
+ - [ ] Alert triage SLAs defined and monitored (15 min for critical)
558
+ - [ ] Threat intelligence feeds integrated into SIEM
559
+ - [ ] Canary tokens/files deployed on critical systems
560
+ - [ ] Log retention meets minimum 90-day hot, 1-year cold requirement
561
+ - [ ] Detection rules mapped to MITRE ATT&CK techniques
562
+
563
+ ### Containment and Eradication Phase
564
+
565
+ - [ ] Network isolation procedures tested and documented
566
+ - [ ] Account lockout procedures cover AD, cloud IAM, SaaS applications
567
+ - [ ] Backup integrity verified monthly; restore tested quarterly
568
+ - [ ] Forensic imaging procedures documented with hash verification
569
+ - [ ] Chain of custody forms available and team trained on use
570
+
571
+ ### Recovery Phase
572
+
573
+ - [ ] Recovery priority list defined (critical services first)
574
+ - [ ] Clean rebuild procedures documented for all system types
575
+ - [ ] Credential rotation procedures cover all credential types
576
+ - [ ] Post-recovery monitoring plan for 90-day watch period
577
+
578
+ ### Post-Incident Phase
579
+
580
+ - [ ] Post-incident review conducted within 5 business days
581
+ - [ ] Root cause analysis documented
582
+ - [ ] Action items assigned with owners and deadlines
583
+ - [ ] IR plan updated based on lessons learned
584
+ - [ ] Metrics updated: MTTD, MTTR, incident count, cost
585
+
586
+ ---
587
+
588
+ ## 6. Tools and Automation
589
+
590
+ ### 6.1 SIEM (Security Information and Event Management)
591
+
592
+ | Tool | Deployment | Strengths | Consideration |
593
+ |---|---|---|---|
594
+ | **Splunk Enterprise Security** | On-prem / Cloud | Mature correlation, extensive app ecosystem | Cost scales with data volume |
595
+ | **Elastic SIEM** | On-prem / Cloud | Open source core, flexible schema | Requires tuning expertise |
596
+ | **Microsoft Sentinel** | Azure Cloud | Native Azure/M365 integration, KQL | Best for Microsoft-heavy environments |
597
+ | **Google Chronicle/SecOps** | Cloud | Massive data ingestion at flat cost | Google ecosystem advantages |
598
+ | **CrowdStrike LogScale** | Cloud | Sub-second search, streaming architecture | Newer entrant |
599
+
600
+ ### 6.2 EDR (Endpoint Detection and Response)
601
+
602
+ | Tool | Key Feature | Deployment |
603
+ |---|---|---|
604
+ | **CrowdStrike Falcon** | Cloud-native, threat intelligence integration | Agent-based, cloud console |
605
+ | **SentinelOne Singularity** | Autonomous response, built-in SOAR | Agent-based, cloud console |
606
+ | **Microsoft Defender for Endpoint** | M365 integration, attack surface reduction | Agent-based, cloud console |
607
+ | **Carbon Black (VMware)** | Behavioral EDR, application control | Agent-based, on-prem/cloud |
608
+ | **Elastic Defend** | Open agent, integrated with Elastic SIEM | Agent-based, self-managed/cloud |
609
+
610
+ ### 6.3 Forensic Tools
611
+
612
+ | Tool | Purpose | Type |
613
+ |---|---|---|
614
+ | **Volatility 3** | Memory forensics and analysis | Open source |
615
+ | **Autopsy / Sleuth Kit** | Disk image analysis, file recovery | Open source |
616
+ | **KAPE (Kroll)** | Rapid triage artifact collection | Commercial (free) |
617
+ | **Velociraptor** | Endpoint visibility and forensic collection at scale | Open source |
618
+ | **FTK Imager** | Forensic disk imaging | Commercial (free) |
619
+ | **Wireshark** | Network packet capture and analysis | Open source |
620
+ | **Plaso/log2timeline** | Super timeline creation from multiple log sources | Open source |
621
+
622
+ ### 6.4 Incident Management Platforms
623
+
624
+ | Tool | Use Case |
625
+ |---|---|
626
+ | **PagerDuty** | On-call management, alert routing, escalation |
627
+ | **Opsgenie (Atlassian)** | Alert aggregation, on-call schedules |
628
+ | **Jira Service Management** | Incident tracking, SLA management |
629
+ | **ServiceNow SecOps** | Enterprise IR workflow, CMDB integration |
630
+ | **TheHive** | Open source IR case management |
631
+ | **DFIR-IRIS** | Open source IR case management with timeline analysis |
632
+
633
+ ### 6.5 Threat Intelligence
634
+
635
+ | Tool | Type |
636
+ |---|---|
637
+ | **MISP** | Open source threat intelligence sharing platform |
638
+ | **AlienVault OTX** | Community threat intelligence feeds |
639
+ | **VirusTotal** | Malware and IOC analysis |
640
+ | **Shodan** | Internet-facing asset discovery |
641
+ | **GreyNoise** | Mass scanner identification (reduce noise) |
642
+ | **Abuse.ch (URLhaus, MalBazaar)** | Malware and URL threat feeds |
643
+
644
+ ### 6.6 SOAR (Security Orchestration, Automation and Response)
645
+
646
+ SOAR platforms reduce MTTR by up to 50% and analyst workload by 40%:
647
+
648
+ | Tool | Deployment | Integration |
649
+ |---|---|---|
650
+ | **Palo Alto XSOAR (Demisto)** | Cloud / On-prem | 700+ integrations |
651
+ | **Splunk SOAR (Phantom)** | Cloud / On-prem | Native Splunk integration |
652
+ | **Tines** | Cloud | No-code automation, strong API support |
653
+ | **Shuffle** | Self-hosted | Open source SOAR |
654
+ | **SentinelOne Singularity** | Cloud | Built-in SOAR capabilities |
655
+
656
+ ---
657
+
658
+ ## 7. Platform-Specific Guidance
659
+
660
+ ### 7.1 AWS Incident Response
661
+
662
+ **Key Services**:
663
+ - **GuardDuty**: Threat detection from CloudTrail, VPC Flow Logs, DNS logs
664
+ - **Security Hub**: Aggregated findings, compliance checks
665
+ - **CloudTrail**: API audit log -- ESSENTIAL for forensics
666
+ - **AWS Security Incident Response**: AI-powered investigation service
667
+ - **Detective**: Visualize and investigate security findings
668
+
669
+ **AWS IR Playbook -- Compromised IAM Credentials**:
670
+ ```
671
+ 1. Identify the compromised access key / role
672
+ aws iam list-access-keys --user-name <user>
673
+
674
+ 2. Disable (do NOT delete) the access key
675
+ aws iam update-access-key --access-key-id <key> --status Inactive --user-name <user>
676
+
677
+ 3. Revoke all active sessions for the role/user
678
+ aws iam put-role-policy --role-name <role> --policy-name DenyAll \
679
+ --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"*","Resource":"*"}]}'
680
+
681
+ 4. Analyze CloudTrail for attacker activity
682
+ aws cloudtrail lookup-events \
683
+ --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=<key> \
684
+ --start-time <time> --end-time <time>
685
+
686
+ 5. Check for persistence mechanisms
687
+ - New IAM users, roles, or policies created
688
+ - Lambda functions deployed
689
+ - EC2 instances launched
690
+ - S3 bucket policies modified
691
+
692
+ 6. Snapshot affected EC2 instances for forensics
693
+ aws ec2 create-snapshot --volume-id <vol-id> --description "IR-forensic-<case-id>"
694
+ ```
695
+
696
+ **CloudTrail Analysis Queries (Athena)**:
697
+ ```sql
698
+ -- Find all actions by a compromised access key
699
+ SELECT eventtime, eventsource, eventname, sourceipaddress,
700
+ requestparameters, responseelements
701
+ FROM cloudtrail_logs
702
+ WHERE useridentity.accesskeyid = 'AKIA...'
703
+ AND eventtime BETWEEN '2025-01-15T00:00:00Z' AND '2025-01-16T00:00:00Z'
704
+ ORDER BY eventtime;
705
+
706
+ -- Detect IAM persistence: new users, roles, policies
707
+ SELECT eventtime, eventname, useridentity.arn, sourceipaddress
708
+ FROM cloudtrail_logs
709
+ WHERE eventname IN ('CreateUser', 'CreateRole', 'CreatePolicy',
710
+ 'AttachUserPolicy', 'AttachRolePolicy',
711
+ 'PutRolePolicy', 'CreateAccessKey')
712
+ AND eventtime > DATE_ADD('day', -7, NOW())
713
+ ORDER BY eventtime;
714
+
715
+ -- Detect data exfiltration via S3
716
+ SELECT eventtime, eventname, requestparameters, sourceipaddress
717
+ FROM cloudtrail_logs
718
+ WHERE eventsource = 's3.amazonaws.com'
719
+ AND eventname IN ('GetObject', 'PutBucketPolicy', 'PutBucketAcl')
720
+ AND sourceipaddress NOT IN ('10.0.0.0/8') -- internal range
721
+ ORDER BY eventtime;
722
+ ```
723
+
724
+ ### 7.2 GCP Incident Response
725
+
726
+ **Key Services**:
727
+ - **Security Command Center (SCC)**: Centralized security findings
728
+ - **Cloud Audit Logs**: API activity (Admin Activity + Data Access logs)
729
+ - **Chronicle**: SIEM and SOAR platform
730
+ - **Cloud Forensics**: Disk snapshot and analysis toolkit
731
+
732
+ **GCP IR Playbook -- Compromised Service Account**:
733
+ ```
734
+ 1. List and disable service account keys
735
+ gcloud iam service-accounts keys list --iam-account <sa-email>
736
+ gcloud iam service-accounts keys disable <key-id> --iam-account <sa-email>
737
+
738
+ 2. Analyze audit logs
739
+ gcloud logging read 'protoPayload.authenticationInfo.principalEmail="<sa-email>"' \
740
+ --project <project> --freshness=7d --format=json
741
+
742
+ 3. Snapshot affected VM disks
743
+ gcloud compute disks snapshot <disk-name> --zone <zone> \
744
+ --snapshot-names ir-forensic-<case-id>
745
+
746
+ 4. Review IAM bindings for persistence
747
+ gcloud projects get-iam-policy <project> --format=json | \
748
+ jq '.bindings[] | select(.members[] | contains("<sa-email>"))'
749
+ ```
750
+
751
+ ### 7.3 Kubernetes Incident Response
752
+
753
+ Container environments require specialized IR procedures due to their ephemeral
754
+ nature. Evidence disappears when containers terminate.
755
+
756
+ **Critical First Actions**:
757
+ ```bash
758
+ # 1. Cordon the node (prevent new scheduling, preserve evidence)
759
+ kubectl cordon <node-name>
760
+
761
+ # 2. Capture pod state before it disappears
762
+ kubectl get pod <pod-name> -n <namespace> -o yaml > pod-state.yaml
763
+ kubectl logs <pod-name> -n <namespace> --all-containers > pod-logs.txt
764
+ kubectl describe pod <pod-name> -n <namespace> > pod-describe.txt
765
+
766
+ # 3. Capture container filesystem
767
+ kubectl cp <namespace>/<pod-name>:/ ./container-fs-dump/ -c <container>
768
+
769
+ # 4. Capture node-level evidence
770
+ # SSH to node, then:
771
+ crictl ps -a # list all containers including stopped
772
+ crictl inspect <container-id> # container metadata
773
+ crictl logs <container-id> # container logs
774
+
775
+ # 5. Snapshot the node's disk for forensic analysis
776
+ # (cloud-provider specific -- see AWS/GCP sections)
777
+
778
+ # 6. After evidence captured, drain the node
779
+ kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
780
+ ```
781
+
782
+ **Runtime Security Tools**:
783
+ - **Falco**: Runtime threat detection via syscall monitoring
784
+ - **Sysdig Secure**: Container forensics and runtime security
785
+ - **Aqua Security**: Container and Kubernetes security platform
786
+ - **KubeArmor**: Runtime enforcement of security policies
787
+
788
+ ### 7.4 Application-Level Incident Response
789
+
790
+ For application-layer incidents (injection, authentication bypass, data leak):
791
+
792
+ 1. **Capture application state**: Thread dumps, heap dumps, connection pools
793
+ 2. **Preserve logs**: Application logs, access logs, error logs, audit logs
794
+ 3. **Database audit**: Query logs, recent schema changes, data modifications
795
+ 4. **API audit**: Recent API key usage, rate limit events, authentication failures
796
+ 5. **Feature flags**: Check for unauthorized feature flag modifications
797
+ 6. **Dependency check**: Verify no dependency tampering (lock file integrity)
798
+
799
+ ---
800
+
801
+ ## 8. Incident Patterns -- Detailed Attack Chains
802
+
803
+ ### 8.1 Ransomware Attack Chain (Double Extortion)
804
+
805
+ ```
806
+ Phase 1: Initial Access (Day 0)
807
+ - Phishing email with macro-enabled document
808
+ - OR: Exploit public-facing VPN/RDP (CVE exploitation)
809
+ - OR: Compromised credentials from infostealers
810
+
811
+ Phase 2: Execution & Persistence (Day 0-1)
812
+ - Macro executes PowerShell downloader
813
+ - Cobalt Strike / Sliver beacon deployed
814
+ - Scheduled tasks or registry run keys for persistence
815
+ - Detect: EDR behavioral alerts, PowerShell logging
816
+
817
+ Phase 3: Credential Access (Day 1-3)
818
+ - Mimikatz / LSASS dump for credential harvesting
819
+ - Kerberoasting for service account hashes
820
+ - DCSync for domain credential replication
821
+ - Detect: Honey tokens, LSASS access alerts
822
+
823
+ Phase 4: Lateral Movement (Day 2-5)
824
+ - PsExec, WMI, WinRM for remote execution
825
+ - RDP with harvested credentials
826
+ - SMB file share access for reconnaissance
827
+ - Detect: Anomalous auth patterns, UEBA alerts
828
+
829
+ Phase 5: Exfiltration (Day 3-7)
830
+ - Data staged in archive files
831
+ - Exfiltrated via HTTPS to cloud storage or Mega
832
+ - Used as leverage for double extortion
833
+ - Detect: DLP alerts, unusual outbound volume
834
+
835
+ Phase 6: Impact (Day 5-14)
836
+ - Disable/delete backups (Veeam, shadow copies)
837
+ - Disable security tools (tamper protection bypass)
838
+ - Deploy ransomware across domain via GPO or PsExec
839
+ - Ransom note dropped
840
+ - Detect: Canary files, mass file operations
841
+ ```
842
+
843
+ ### 8.2 Cloud Account Takeover Chain
844
+
845
+ ```
846
+ Phase 1: Initial Access
847
+ - Phished cloud console credentials
848
+ - Leaked access keys in public repository
849
+ - Compromised CI/CD pipeline with cloud credentials
850
+
851
+ Phase 2: Reconnaissance
852
+ - Enumerate IAM users, roles, policies
853
+ - List S3 buckets, databases, secrets
854
+ - Map network topology (VPCs, subnets, peering)
855
+ - Detect: GuardDuty Recon findings, unusual API patterns
856
+
857
+ Phase 3: Privilege Escalation
858
+ - Attach admin policy to compromised role
859
+ - Create new access keys for existing admin users
860
+ - Assume cross-account roles
861
+ - Detect: IAM policy change alerts, CloudTrail anomalies
862
+
863
+ Phase 4: Persistence
864
+ - Create new IAM users with console access
865
+ - Deploy Lambda for backdoor access
866
+ - Modify trust policies on existing roles
867
+ - Detect: New IAM entity alerts, Lambda deployment monitoring
868
+
869
+ Phase 5: Impact
870
+ - Data exfiltration from S3/RDS/DynamoDB
871
+ - Cryptomining on large EC2 instances
872
+ - Resource destruction (deletion of infrastructure)
873
+ - Detect: Cost anomalies, data transfer alerts
874
+ ```
875
+
876
+ ### 8.3 Supply Chain Attack Pattern
877
+
878
+ ```
879
+ Phase 1: Vendor Compromise
880
+ - Attacker compromises build system of trusted vendor
881
+ - Malicious code injected into software update
882
+ - Signed with legitimate vendor certificate
883
+
884
+ Phase 2: Distribution
885
+ - Trojanized update distributed through normal channels
886
+ - Customers install automatically (trusted source)
887
+ - Backdoor activates after delay or on specific trigger
888
+
889
+ Phase 3: Command and Control
890
+ - Backdoor communicates with attacker infrastructure
891
+ - Disguised as legitimate vendor traffic
892
+ - DNS-based or HTTPS-based C2
893
+
894
+ Phase 4: Lateral Movement
895
+ - Use privileges of compromised application
896
+ - Access secrets, tokens, API keys managed by application
897
+ - Pivot to additional systems using harvested credentials
898
+
899
+ Detection Strategy:
900
+ - Monitor behavioral baselines of all software (new connections, processes)
901
+ - Verify checksums of installed software against vendor manifests
902
+ - Implement network segmentation for vendor software
903
+ - Subscribe to vendor security advisories and threat intel feeds
904
+ ```
905
+
906
+ ---
907
+
908
+ ## 9. Compliance and Standards
909
+
910
+ ### 9.1 NIST SP 800-61 Rev. 3 (April 2025)
911
+
912
+ Major changes from Rev. 2:
913
+ - Aligns with NIST CSF 2.0 six functions (Govern, Identify, Protect, Detect, Respond, Recover)
914
+ - Emphasizes IR as part of broader cybersecurity risk management, not a standalone activity
915
+ - Incident preparation activities mapped across Govern, Identify, and Protect functions
916
+ - Recognizes that modern incidents are more frequent, complex, and dynamic
917
+ - Replaces the four-phase lifecycle with CSF 2.0 function mapping while maintaining
918
+ conceptual continuity
919
+
920
+ ### 9.2 GDPR Breach Notification (Articles 33-34)
921
+
922
+ - **Article 33**: Notify supervisory authority within 72 hours of becoming "aware"
923
+ - **Article 34**: Notify affected data subjects "without undue delay" if high risk
924
+ - "Awareness" = reasonable degree of certainty that personal data was compromised
925
+ - Notification must include: nature of breach, categories and approximate number of
926
+ data subjects, likely consequences, measures taken to address and mitigate
927
+ - If 72 hours not feasible, provide reasons for delay with notification
928
+ - Document ALL breaches regardless of notification requirement (accountability principle)
929
+
930
+ ### 9.3 PCI-DSS Incident Response (Requirement 12.10)
931
+
932
+ - **12.10.1**: Establish an IR plan; be prepared to respond immediately to a breach
933
+ - **12.10.2**: Review and test the plan at least annually
934
+ - **12.10.3**: Designate specific personnel to be available 24/7 for incident response
935
+ - **12.10.4**: Provide appropriate training to staff with IR responsibilities
936
+ - **12.10.4.1**: Periodically train IR personnel (frequency based on risk assessment)
937
+ - **12.10.5**: Include alerts from security monitoring systems (IDS/IPS, FIM, etc.)
938
+ - **12.10.6**: Evolve and update the IR plan based on lessons learned and industry changes
939
+ - **12.10.7**: Incident response procedures in place for detection of unauthorized
940
+ wireless access points (PCI-DSS v4.0 specific requirement)
941
+
942
+ Card brand notification: Notify the payment card brands and acquirer within 24-72
943
+ hours depending on brand-specific requirements.
944
+
945
+ ### 9.4 SOC 2 Incident Management (Common Criteria 7.x)
946
+
947
+ - **CC7.2**: Monitor system components for anomalies indicative of malicious acts
948
+ - **CC7.3**: Evaluate detected events to determine if they constitute incidents
949
+ - **CC7.4**: Respond to identified security incidents using defined procedures
950
+ - **CC7.5**: Identify the root cause and communicate remediation to prevent recurrence
951
+ - Annual IR plan testing is required for SOC 2 Type II certification
952
+ - All incidents must be documented with classification, response, and resolution
953
+ - Incidents that affect service commitments must be disclosed in SOC 2 reports
954
+
955
+ ### 9.5 State Breach Notification Laws (US)
956
+
957
+ All 50 US states plus DC, Guam, Puerto Rico, and USVI have breach notification laws.
958
+ Key variations:
959
+
960
+ | State | Notification Window | Notable Requirement |
961
+ |---|---|---|
962
+ | California (CCPA/CPRA) | "Most expedient time possible" | Private right of action for breaches |
963
+ | New York (SHIELD Act) | "Most expedient time possible" | Broad definition of private information |
964
+ | Texas | 60 days | AG notification required for 250+ residents |
965
+ | Florida | 30 days | Penalties up to $500K for failure to notify |
966
+ | Colorado | 30 days | AG notification within 30 days |
967
+ | Massachusetts | "As soon as practicable" | Requires specific security program elements |
968
+
969
+ ### 9.6 CISA Reporting (CIRCIA)
970
+
971
+ The Cyber Incident Reporting for Critical Infrastructure Act (2022):
972
+ - Covered entities in 16 critical infrastructure sectors
973
+ - 72-hour reporting for covered cyber incidents
974
+ - 24-hour reporting for ransom payments
975
+ - Supplemental reports required if substantially new information emerges
976
+ - Reports submitted to CISA; shared with relevant agencies
977
+ - Safe harbor: reports cannot be used for regulatory enforcement against reporter
978
+
979
+ ---
980
+
981
+ ## 10. Code Examples
982
+
983
+ ### 10.1 Incident Severity Calculator
984
+
985
+ ```python
986
+ """
987
+ Incident severity calculator based on impact and urgency.
988
+ Use during initial triage to consistently classify incidents.
989
+ """
990
+
991
+ from enum import IntEnum
992
+ from datetime import datetime
993
+
994
+ class Impact(IntEnum):
995
+ CRITICAL = 4 # Organization-wide, customer data, production down
996
+ HIGH = 3 # Department-wide, sensitive data, major service degraded
997
+ MEDIUM = 2 # Team-level, internal data, minor service degraded
998
+ LOW = 1 # Individual, no sensitive data, no service impact
999
+
1000
+ class Urgency(IntEnum):
1001
+ CRITICAL = 4 # Active attack, spreading, time-sensitive regulatory
1002
+ HIGH = 3 # Confirmed compromise, potential for spread
1003
+ MEDIUM = 2 # Suspicious activity, contained, no active threat
1004
+ LOW = 1 # Informational, historical, no immediate action
1005
+
1006
+ SEVERITY_MATRIX = {
1007
+ (4, 4): "SEV-1", (4, 3): "SEV-1", (4, 2): "SEV-2", (4, 1): "SEV-2",
1008
+ (3, 4): "SEV-1", (3, 3): "SEV-2", (3, 2): "SEV-2", (3, 1): "SEV-3",
1009
+ (2, 4): "SEV-2", (2, 3): "SEV-2", (2, 2): "SEV-3", (2, 1): "SEV-3",
1010
+ (1, 4): "SEV-2", (1, 3): "SEV-3", (1, 2): "SEV-4", (1, 1): "SEV-5",
1011
+ }
1012
+
1013
+ RESPONSE_SLA = {
1014
+ "SEV-1": "15 minutes",
1015
+ "SEV-2": "30 minutes",
1016
+ "SEV-3": "2 hours",
1017
+ "SEV-4": "8 hours",
1018
+ "SEV-5": "Next business day",
1019
+ }
1020
+
1021
+ def classify_incident(impact: Impact, urgency: Urgency) -> dict:
1022
+ severity = SEVERITY_MATRIX[(impact.value, urgency.value)]
1023
+ return {
1024
+ "severity": severity,
1025
+ "impact": impact.name,
1026
+ "urgency": urgency.name,
1027
+ "response_sla": RESPONSE_SLA[severity],
1028
+ "classified_at": datetime.utcnow().isoformat() + "Z",
1029
+ }
1030
+
1031
+ # Usage:
1032
+ # result = classify_incident(Impact.CRITICAL, Urgency.HIGH)
1033
+ # => {"severity": "SEV-1", "response_sla": "15 minutes", ...}
1034
+ ```
1035
+
1036
+ ### 10.2 Notification Timeline Tracker
1037
+
1038
+ ```python
1039
+ """
1040
+ Track regulatory notification deadlines from moment of breach awareness.
1041
+ Alerts when deadlines are approaching.
1042
+ """
1043
+
1044
+ from datetime import datetime, timedelta
1045
+ from dataclasses import dataclass, field
1046
+
1047
+ @dataclass
1048
+ class NotificationDeadline:
1049
+ regulation: str
1050
+ recipient: str
1051
+ hours: int
1052
+ notified: bool = False
1053
+ notified_at: str | None = None
1054
+
1055
+ @dataclass
1056
+ class BreachTimeline:
1057
+ case_id: str
1058
+ awareness_time: datetime
1059
+ deadlines: list[NotificationDeadline] = field(default_factory=list)
1060
+
1061
+ def __post_init__(self):
1062
+ if not self.deadlines:
1063
+ self.deadlines = [
1064
+ NotificationDeadline("CISA/CIRCIA", "CISA", 72),
1065
+ NotificationDeadline("CISA/CIRCIA (ransom)", "CISA", 24),
1066
+ NotificationDeadline("GDPR Art.33", "Supervisory Authority", 72),
1067
+ NotificationDeadline("GDPR Art.34", "Data Subjects", 72),
1068
+ NotificationDeadline("SEC 8-K", "SEC", 96),
1069
+ NotificationDeadline("PCI-DSS", "Card Brands", 72),
1070
+ NotificationDeadline("HIPAA", "HHS OCR", 1440), # 60 days
1071
+ NotificationDeadline("NIS2 Early Warning", "CSIRT", 24),
1072
+ NotificationDeadline("NIS2 Full", "CSIRT", 72),
1073
+ ]
1074
+
1075
+ def check_deadlines(self) -> list[dict]:
1076
+ now = datetime.utcnow()
1077
+ alerts = []
1078
+ for d in self.deadlines:
1079
+ deadline = self.awareness_time + timedelta(hours=d.hours)
1080
+ remaining = deadline - now
1081
+ hours_left = remaining.total_seconds() / 3600
1082
+ alerts.append({
1083
+ "regulation": d.regulation,
1084
+ "recipient": d.recipient,
1085
+ "deadline": deadline.isoformat() + "Z",
1086
+ "hours_remaining": round(hours_left, 1),
1087
+ "status": "NOTIFIED" if d.notified else
1088
+ "OVERDUE" if hours_left < 0 else
1089
+ "URGENT" if hours_left < 6 else
1090
+ "WARNING" if hours_left < 24 else "OK",
1091
+ "notified": d.notified,
1092
+ })
1093
+ return sorted(alerts, key=lambda x: x["hours_remaining"])
1094
+
1095
+ def mark_notified(self, regulation: str):
1096
+ for d in self.deadlines:
1097
+ if d.regulation == regulation:
1098
+ d.notified = True
1099
+ d.notified_at = datetime.utcnow().isoformat() + "Z"
1100
+
1101
+ # Usage:
1102
+ # timeline = BreachTimeline("IR-2025-042", datetime(2025, 6, 15, 14, 30))
1103
+ # print(timeline.check_deadlines())
1104
+ ```
1105
+
1106
+ ### 10.3 Post-Incident Report Template
1107
+
1108
+ ```markdown
1109
+ # Post-Incident Report
1110
+
1111
+ ## Incident Summary
1112
+ - **Case ID**: IR-YYYY-NNN
1113
+ - **Severity**: SEV-N
1114
+ - **Status**: Closed
1115
+ - **Date Detected**: YYYY-MM-DD HH:MM UTC
1116
+ - **Date Resolved**: YYYY-MM-DD HH:MM UTC
1117
+ - **Duration**: N hours
1118
+ - **MTTD (Mean Time to Detect)**: N hours from initial compromise
1119
+ - **MTTR (Mean Time to Respond)**: N hours from detection to containment
1120
+
1121
+ ## Incident Description
1122
+ [2-3 paragraph summary of what happened]
1123
+
1124
+ ## Timeline
1125
+ | Time (UTC) | Event |
1126
+ |---|---|
1127
+ | YYYY-MM-DD HH:MM | Initial compromise occurred |
1128
+ | YYYY-MM-DD HH:MM | Alert triggered by [system] |
1129
+ | YYYY-MM-DD HH:MM | SOC analyst began triage |
1130
+ | YYYY-MM-DD HH:MM | Incident declared, CSIRT activated |
1131
+ | YYYY-MM-DD HH:MM | Containment actions implemented |
1132
+ | YYYY-MM-DD HH:MM | Eradication completed |
1133
+ | YYYY-MM-DD HH:MM | Recovery and service restoration |
1134
+ | YYYY-MM-DD HH:MM | Incident closed |
1135
+
1136
+ ## Root Cause Analysis
1137
+ [What was the root cause? How did the attacker gain access?]
1138
+
1139
+ ## Impact Assessment
1140
+ - **Systems affected**: [list]
1141
+ - **Data affected**: [type, volume, sensitivity]
1142
+ - **Business impact**: [downtime, revenue, reputation]
1143
+ - **Users/customers affected**: [count, notification status]
1144
+
1145
+ ## Response Effectiveness
1146
+ - **What worked well**: [list]
1147
+ - **What could improve**: [list]
1148
+ - **Detection gap**: [how could we detect this sooner?]
1149
+
1150
+ ## Regulatory Notifications
1151
+ | Regulation | Deadline | Notified | Date |
1152
+ |---|---|---|---|
1153
+ | [regulation] | [deadline] | Yes/No | [date] |
1154
+
1155
+ ## Action Items
1156
+ | # | Action | Owner | Deadline | Status |
1157
+ |---|---|---|---|---|
1158
+ | 1 | [action] | [owner] | [date] | Open |
1159
+
1160
+ ## Lessons Learned
1161
+ [Key takeaways and systemic improvements needed]
1162
+ ```
1163
+
1164
+ ### 10.4 Automated CloudTrail Suspicious Activity Detector
1165
+
1166
+ ```python
1167
+ """
1168
+ Scan CloudTrail logs for common attacker behaviors.
1169
+ Run as a Lambda or scheduled job for continuous monitoring.
1170
+ """
1171
+
1172
+ import json
1173
+ from datetime import datetime, timedelta
1174
+
1175
+ # High-risk API calls that indicate potential compromise
1176
+ SUSPICIOUS_EVENTS = {
1177
+ "persistence": [
1178
+ "CreateUser", "CreateRole", "CreateAccessKey",
1179
+ "AttachUserPolicy", "AttachRolePolicy", "PutRolePolicy",
1180
+ "CreateLoginProfile", "UpdateAssumeRolePolicy",
1181
+ ],
1182
+ "defense_evasion": [
1183
+ "StopLogging", "DeleteTrail", "UpdateTrail",
1184
+ "PutEventSelectors", "DeleteFlowLogs",
1185
+ "DisableGuardDuty", "DeleteDetector",
1186
+ ],
1187
+ "exfiltration": [
1188
+ "PutBucketPolicy", "PutBucketAcl",
1189
+ "ModifySnapshotAttribute", "ModifyImageAttribute",
1190
+ "CreateSnapshot", "SharedSnapshotCopyInitiated",
1191
+ ],
1192
+ "credential_access": [
1193
+ "GetSecretValue", "GetParametersByPath",
1194
+ "GetCallerIdentity", # reconnaissance indicator
1195
+ ],
1196
+ }
1197
+
1198
+ def analyze_cloudtrail_event(event: dict) -> dict | None:
1199
+ """Analyze a single CloudTrail event for suspicious activity."""
1200
+ event_name = event.get("eventName", "")
1201
+ source_ip = event.get("sourceIPAddress", "")
1202
+ user_arn = event.get("userIdentity", {}).get("arn", "")
1203
+ event_time = event.get("eventTime", "")
1204
+
1205
+ for category, events in SUSPICIOUS_EVENTS.items():
1206
+ if event_name in events:
1207
+ return {
1208
+ "category": category,
1209
+ "event_name": event_name,
1210
+ "source_ip": source_ip,
1211
+ "user_arn": user_arn,
1212
+ "event_time": event_time,
1213
+ "risk": "HIGH" if category in ("defense_evasion", "persistence") else "MEDIUM",
1214
+ "raw_event": event,
1215
+ }
1216
+ return None
1217
+
1218
+ def detect_impossible_travel(events: list[dict], max_speed_kmh: int = 900) -> list[dict]:
1219
+ """Detect logins from geographically impossible locations."""
1220
+ # Group events by user, check for impossible location changes
1221
+ # Implementation requires GeoIP lookup for source IPs
1222
+ # Returns list of alerts for impossible travel detections
1223
+ alerts = []
1224
+ # ... GeoIP-based implementation ...
1225
+ return alerts
1226
+
1227
+ # Usage: Process CloudTrail log files
1228
+ # for record in cloudtrail_records:
1229
+ # alert = analyze_cloudtrail_event(record)
1230
+ # if alert:
1231
+ # send_to_siem(alert)
1232
+ ```
1233
+
1234
+ ### 10.5 IR Automation: Endpoint Isolation Script
1235
+
1236
+ ```bash
1237
+ #!/usr/bin/env bash
1238
+ # ir-isolate.sh -- Isolate a compromised host via firewall rules
1239
+ # Usage: ./ir-isolate.sh <hostname-or-ip> <case-id>
1240
+ # Requires: SSH access to target, sudo privileges
1241
+
1242
+ set -euo pipefail
1243
+
1244
+ HOST="${1:?Usage: $0 <hostname-or-ip> <case-id>}"
1245
+ CASE_ID="${2:?Usage: $0 <hostname-or-ip> <case-id>}"
1246
+ TIMESTAMP=$(date -u +"%Y%m%dT%H%M%SZ")
1247
+ LOG_FILE="/var/log/ir/${CASE_ID}-isolate-${TIMESTAMP}.log"
1248
+ IR_ADMIN_IP="${IR_ADMIN_IP:?Set IR_ADMIN_IP to your IR workstation IP}"
1249
+
1250
+ mkdir -p /var/log/ir
1251
+
1252
+ echo "[${TIMESTAMP}] Isolating host ${HOST} for case ${CASE_ID}" | tee -a "${LOG_FILE}"
1253
+
1254
+ # Step 1: Capture current network state before isolation
1255
+ ssh "${HOST}" "
1256
+ echo '=== Network connections ===' && ss -tulnp
1257
+ echo '=== Routing table ===' && ip route
1258
+ echo '=== ARP table ===' && ip neigh
1259
+ echo '=== Firewall rules ===' && iptables -L -n -v
1260
+ " >> "${LOG_FILE}" 2>&1
1261
+
1262
+ # Step 2: Apply isolation firewall rules (allow only IR admin access)
1263
+ ssh "${HOST}" "
1264
+ sudo iptables -I INPUT 1 -s ${IR_ADMIN_IP} -j ACCEPT
1265
+ sudo iptables -I OUTPUT 1 -d ${IR_ADMIN_IP} -j ACCEPT
1266
+ sudo iptables -I INPUT 2 -m state --state ESTABLISHED,RELATED -j ACCEPT
1267
+ sudo iptables -I OUTPUT 2 -m state --state ESTABLISHED,RELATED -j ACCEPT
1268
+ sudo iptables -A INPUT -j DROP
1269
+ sudo iptables -A OUTPUT -j DROP
1270
+ sudo iptables -A FORWARD -j DROP
1271
+ "
1272
+
1273
+ echo "[$(date -u +%Y%m%dT%H%M%SZ)] Host ${HOST} isolated. Only ${IR_ADMIN_IP} can connect." \
1274
+ | tee -a "${LOG_FILE}"
1275
+ echo "[INFO] To reverse: ssh ${HOST} sudo iptables -F" | tee -a "${LOG_FILE}"
1276
+ ```
1277
+
1278
+ ---
1279
+
1280
+ ## References
1281
+
1282
+ - NIST SP 800-61 Rev. 3 (April 2025) -- Incident Response Recommendations and Considerations
1283
+ - NIST Cybersecurity Framework 2.0 (February 2024)
1284
+ - IBM Cost of a Data Breach Report 2024, 2025
1285
+ - Mandiant M-Trends 2025 Report
1286
+ - Sophos Active Adversary Report 2025
1287
+ - MITRE ATT&CK Framework (attack.mitre.org)
1288
+ - GDPR Articles 33-34 -- Breach Notification
1289
+ - PCI-DSS v4.0 Requirement 12.10
1290
+ - SOC 2 Common Criteria (CC7.2-CC7.5)
1291
+ - CISA Cyber Incident Reporting for Critical Infrastructure Act (CIRCIA)
1292
+ - AWS Security Incident Response Guide
1293
+ - GCP Security Command Center Documentation
1294
+ - CrowdStrike Falcon Platform Documentation
1295
+ - SentinelOne Singularity Platform Documentation