clawsec 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +560 -0
- package/dist/bin/clawsec.d.ts +7 -0
- package/dist/bin/clawsec.d.ts.map +1 -0
- package/dist/bin/clawsec.js +12 -0
- package/dist/bin/clawsec.js.map +1 -0
- package/dist/src/actions/block.d.ts +22 -0
- package/dist/src/actions/block.d.ts.map +1 -0
- package/dist/src/actions/block.js +83 -0
- package/dist/src/actions/block.js.map +1 -0
- package/dist/src/actions/confirm.d.ts +35 -0
- package/dist/src/actions/confirm.d.ts.map +1 -0
- package/dist/src/actions/confirm.js +156 -0
- package/dist/src/actions/confirm.js.map +1 -0
- package/dist/src/actions/executor.d.ts +64 -0
- package/dist/src/actions/executor.d.ts.map +1 -0
- package/dist/src/actions/executor.js +114 -0
- package/dist/src/actions/executor.js.map +1 -0
- package/dist/src/actions/index.d.ts +13 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +15 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/log.d.ts +19 -0
- package/dist/src/actions/log.d.ts.map +1 -0
- package/dist/src/actions/log.js +63 -0
- package/dist/src/actions/log.js.map +1 -0
- package/dist/src/actions/types.d.ts +85 -0
- package/dist/src/actions/types.d.ts.map +1 -0
- package/dist/src/actions/types.js +78 -0
- package/dist/src/actions/types.js.map +1 -0
- package/dist/src/actions/warn.d.ts +22 -0
- package/dist/src/actions/warn.d.ts.map +1 -0
- package/dist/src/actions/warn.js +84 -0
- package/dist/src/actions/warn.js.map +1 -0
- package/dist/src/approval/agent-confirm.d.ts +104 -0
- package/dist/src/approval/agent-confirm.d.ts.map +1 -0
- package/dist/src/approval/agent-confirm.js +173 -0
- package/dist/src/approval/agent-confirm.js.map +1 -0
- package/dist/src/approval/index.d.ts +14 -0
- package/dist/src/approval/index.d.ts.map +1 -0
- package/dist/src/approval/index.js +9 -0
- package/dist/src/approval/index.js.map +1 -0
- package/dist/src/approval/native.d.ts +56 -0
- package/dist/src/approval/native.d.ts.map +1 -0
- package/dist/src/approval/native.js +196 -0
- package/dist/src/approval/native.js.map +1 -0
- package/dist/src/approval/store.d.ts +88 -0
- package/dist/src/approval/store.d.ts.map +1 -0
- package/dist/src/approval/store.js +192 -0
- package/dist/src/approval/store.js.map +1 -0
- package/dist/src/approval/types.d.ts +119 -0
- package/dist/src/approval/types.d.ts.map +1 -0
- package/dist/src/approval/types.js +6 -0
- package/dist/src/approval/types.js.map +1 -0
- package/dist/src/approval/webhook.d.ts +170 -0
- package/dist/src/approval/webhook.d.ts.map +1 -0
- package/dist/src/approval/webhook.js +362 -0
- package/dist/src/approval/webhook.js.map +1 -0
- package/dist/src/cli/commands/audit.d.ts +43 -0
- package/dist/src/cli/commands/audit.d.ts.map +1 -0
- package/dist/src/cli/commands/audit.js +115 -0
- package/dist/src/cli/commands/audit.js.map +1 -0
- package/dist/src/cli/commands/feedback.d.ts +27 -0
- package/dist/src/cli/commands/feedback.d.ts.map +1 -0
- package/dist/src/cli/commands/feedback.js +228 -0
- package/dist/src/cli/commands/feedback.js.map +1 -0
- package/dist/src/cli/commands/index.d.ts +11 -0
- package/dist/src/cli/commands/index.d.ts.map +1 -0
- package/dist/src/cli/commands/index.js +13 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +20 -0
- package/dist/src/cli/commands/status.d.ts.map +1 -0
- package/dist/src/cli/commands/status.js +122 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/commands/test.d.ts +23 -0
- package/dist/src/cli/commands/test.d.ts.map +1 -0
- package/dist/src/cli/commands/test.js +134 -0
- package/dist/src/cli/commands/test.js.map +1 -0
- package/dist/src/cli/commands/types.d.ts +81 -0
- package/dist/src/cli/commands/types.d.ts.map +1 -0
- package/dist/src/cli/commands/types.js +6 -0
- package/dist/src/cli/commands/types.js.map +1 -0
- package/dist/src/cli/index.d.ts +17 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +267 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/config/defaults.d.ts +20 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +123 -0
- package/dist/src/config/defaults.js.map +1 -0
- package/dist/src/config/index.d.ts +8 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +41 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/loader.d.ts +99 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +242 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +627 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +585 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.js +556 -0
- package/dist/src/detectors/destructive/cloud-detector.js.map +1 -0
- package/dist/src/detectors/destructive/code-detector.d.ts +59 -0
- package/dist/src/detectors/destructive/code-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/code-detector.js +558 -0
- package/dist/src/detectors/destructive/code-detector.js.map +1 -0
- package/dist/src/detectors/destructive/index.d.ts +54 -0
- package/dist/src/detectors/destructive/index.d.ts.map +1 -0
- package/dist/src/detectors/destructive/index.js +168 -0
- package/dist/src/detectors/destructive/index.js.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts +43 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.js +302 -0
- package/dist/src/detectors/destructive/shell-detector.js.map +1 -0
- package/dist/src/detectors/destructive/types.d.ts +143 -0
- package/dist/src/detectors/destructive/types.d.ts.map +1 -0
- package/dist/src/detectors/destructive/types.js +6 -0
- package/dist/src/detectors/destructive/types.js.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js +427 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts +47 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.js +429 -0
- package/dist/src/detectors/exfiltration/http-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/index.d.ts +44 -0
- package/dist/src/detectors/exfiltration/index.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/index.js +118 -0
- package/dist/src/detectors/exfiltration/index.js.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts +55 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.js +504 -0
- package/dist/src/detectors/exfiltration/network-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/types.d.ts +139 -0
- package/dist/src/detectors/exfiltration/types.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/types.js +6 -0
- package/dist/src/detectors/exfiltration/types.js.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts +44 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.js +296 -0
- package/dist/src/detectors/purchase/domain-detector.js.map +1 -0
- package/dist/src/detectors/purchase/form-detector.d.ts +27 -0
- package/dist/src/detectors/purchase/form-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/form-detector.js +344 -0
- package/dist/src/detectors/purchase/form-detector.js.map +1 -0
- package/dist/src/detectors/purchase/index.d.ts +65 -0
- package/dist/src/detectors/purchase/index.d.ts.map +1 -0
- package/dist/src/detectors/purchase/index.js +216 -0
- package/dist/src/detectors/purchase/index.js.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts +132 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.js +313 -0
- package/dist/src/detectors/purchase/spend-tracker.js.map +1 -0
- package/dist/src/detectors/purchase/types.d.ts +139 -0
- package/dist/src/detectors/purchase/types.d.ts.map +1 -0
- package/dist/src/detectors/purchase/types.js +6 -0
- package/dist/src/detectors/purchase/types.js.map +1 -0
- package/dist/src/detectors/purchase/url-detector.d.ts +31 -0
- package/dist/src/detectors/purchase/url-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/url-detector.js +292 -0
- package/dist/src/detectors/purchase/url-detector.js.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts +30 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.js +297 -0
- package/dist/src/detectors/secrets/api-key-detector.js.map +1 -0
- package/dist/src/detectors/secrets/index.d.ts +43 -0
- package/dist/src/detectors/secrets/index.d.ts.map +1 -0
- package/dist/src/detectors/secrets/index.js +261 -0
- package/dist/src/detectors/secrets/index.js.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts +54 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.js +286 -0
- package/dist/src/detectors/secrets/pii-detector.js.map +1 -0
- package/dist/src/detectors/secrets/token-detector.d.ts +51 -0
- package/dist/src/detectors/secrets/token-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/token-detector.js +233 -0
- package/dist/src/detectors/secrets/token-detector.js.map +1 -0
- package/dist/src/detectors/secrets/types.d.ts +157 -0
- package/dist/src/detectors/secrets/types.d.ts.map +1 -0
- package/dist/src/detectors/secrets/types.js +6 -0
- package/dist/src/detectors/secrets/types.js.map +1 -0
- package/dist/src/detectors/website/category-detector.d.ts +22 -0
- package/dist/src/detectors/website/category-detector.d.ts.map +1 -0
- package/dist/src/detectors/website/category-detector.js +162 -0
- package/dist/src/detectors/website/category-detector.js.map +1 -0
- package/dist/src/detectors/website/index.d.ts +53 -0
- package/dist/src/detectors/website/index.d.ts.map +1 -0
- package/dist/src/detectors/website/index.js +232 -0
- package/dist/src/detectors/website/index.js.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts +33 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.js +121 -0
- package/dist/src/detectors/website/pattern-matcher.js.map +1 -0
- package/dist/src/detectors/website/types.d.ts +105 -0
- package/dist/src/detectors/website/types.d.ts.map +1 -0
- package/dist/src/detectors/website/types.js +6 -0
- package/dist/src/detectors/website/types.js.map +1 -0
- package/dist/src/engine/analyzer.d.ts +87 -0
- package/dist/src/engine/analyzer.d.ts.map +1 -0
- package/dist/src/engine/analyzer.js +427 -0
- package/dist/src/engine/analyzer.js.map +1 -0
- package/dist/src/engine/cache.d.ts +80 -0
- package/dist/src/engine/cache.d.ts.map +1 -0
- package/dist/src/engine/cache.js +167 -0
- package/dist/src/engine/cache.js.map +1 -0
- package/dist/src/engine/index.d.ts +11 -0
- package/dist/src/engine/index.d.ts.map +1 -0
- package/dist/src/engine/index.js +11 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/llm-client.d.ts +210 -0
- package/dist/src/engine/llm-client.d.ts.map +1 -0
- package/dist/src/engine/llm-client.js +506 -0
- package/dist/src/engine/llm-client.js.map +1 -0
- package/dist/src/engine/types.d.ts +163 -0
- package/dist/src/engine/types.d.ts.map +1 -0
- package/dist/src/engine/types.js +21 -0
- package/dist/src/engine/types.js.map +1 -0
- package/dist/src/feedback/index.d.ts +9 -0
- package/dist/src/feedback/index.d.ts.map +1 -0
- package/dist/src/feedback/index.js +8 -0
- package/dist/src/feedback/index.js.map +1 -0
- package/dist/src/feedback/learner.d.ts +222 -0
- package/dist/src/feedback/learner.d.ts.map +1 -0
- package/dist/src/feedback/learner.js +401 -0
- package/dist/src/feedback/learner.js.map +1 -0
- package/dist/src/feedback/store.d.ts +113 -0
- package/dist/src/feedback/store.d.ts.map +1 -0
- package/dist/src/feedback/store.js +228 -0
- package/dist/src/feedback/store.js.map +1 -0
- package/dist/src/feedback/types.d.ts +126 -0
- package/dist/src/feedback/types.d.ts.map +1 -0
- package/dist/src/feedback/types.js +6 -0
- package/dist/src/feedback/types.js.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts +37 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.js +109 -0
- package/dist/src/hooks/before-agent-start/handler.js.map +1 -0
- package/dist/src/hooks/before-agent-start/index.d.ts +8 -0
- package/dist/src/hooks/before-agent-start/index.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/index.js +7 -0
- package/dist/src/hooks/before-agent-start/index.js.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts +48 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.js +103 -0
- package/dist/src/hooks/before-agent-start/prompts.js.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts +42 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.js +226 -0
- package/dist/src/hooks/before-tool-call/handler.js.map +1 -0
- package/dist/src/hooks/before-tool-call/index.d.ts +7 -0
- package/dist/src/hooks/before-tool-call/index.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/index.js +6 -0
- package/dist/src/hooks/before-tool-call/index.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts +72 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.js +305 -0
- package/dist/src/hooks/tool-result-persist/filter.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts +49 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.js +217 -0
- package/dist/src/hooks/tool-result-persist/handler.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts +11 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.js +11 -0
- package/dist/src/hooks/tool-result-persist/index.js.map +1 -0
- package/dist/src/index.d.ts +256 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +222 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/notifications/discord.d.ts +10 -0
- package/dist/src/notifications/discord.d.ts.map +1 -0
- package/dist/src/notifications/discord.js +218 -0
- package/dist/src/notifications/discord.js.map +1 -0
- package/dist/src/notifications/index.d.ts +37 -0
- package/dist/src/notifications/index.d.ts.map +1 -0
- package/dist/src/notifications/index.js +68 -0
- package/dist/src/notifications/index.js.map +1 -0
- package/dist/src/notifications/slack.d.ts +10 -0
- package/dist/src/notifications/slack.d.ts.map +1 -0
- package/dist/src/notifications/slack.js +218 -0
- package/dist/src/notifications/slack.js.map +1 -0
- package/dist/src/notifications/telegram.d.ts +10 -0
- package/dist/src/notifications/telegram.d.ts.map +1 -0
- package/dist/src/notifications/telegram.js +242 -0
- package/dist/src/notifications/telegram.js.map +1 -0
- package/dist/src/notifications/types.d.ts +119 -0
- package/dist/src/notifications/types.d.ts.map +1 -0
- package/dist/src/notifications/types.js +6 -0
- package/dist/src/notifications/types.js.map +1 -0
- package/dist/src/proxy/index.d.ts +8 -0
- package/dist/src/proxy/index.d.ts.map +1 -0
- package/dist/src/proxy/index.js +9 -0
- package/dist/src/proxy/index.js.map +1 -0
- package/dist/src/proxy/middleware.d.ts +55 -0
- package/dist/src/proxy/middleware.d.ts.map +1 -0
- package/dist/src/proxy/middleware.js +215 -0
- package/dist/src/proxy/middleware.js.map +1 -0
- package/dist/src/proxy/server.d.ts +57 -0
- package/dist/src/proxy/server.d.ts.map +1 -0
- package/dist/src/proxy/server.js +298 -0
- package/dist/src/proxy/server.js.map +1 -0
- package/dist/src/proxy/types.d.ts +136 -0
- package/dist/src/proxy/types.d.ts.map +1 -0
- package/dist/src/proxy/types.js +6 -0
- package/dist/src/proxy/types.js.map +1 -0
- package/dist/src/sanitization/index.d.ts +10 -0
- package/dist/src/sanitization/index.d.ts.map +1 -0
- package/dist/src/sanitization/index.js +9 -0
- package/dist/src/sanitization/index.js.map +1 -0
- package/dist/src/sanitization/patterns.d.ts +51 -0
- package/dist/src/sanitization/patterns.d.ts.map +1 -0
- package/dist/src/sanitization/patterns.js +266 -0
- package/dist/src/sanitization/patterns.js.map +1 -0
- package/dist/src/sanitization/scanner.d.ts +29 -0
- package/dist/src/sanitization/scanner.d.ts.map +1 -0
- package/dist/src/sanitization/scanner.js +328 -0
- package/dist/src/sanitization/scanner.js.map +1 -0
- package/dist/src/sanitization/types.d.ts +57 -0
- package/dist/src/sanitization/types.d.ts.map +1 -0
- package/dist/src/sanitization/types.js +5 -0
- package/dist/src/sanitization/types.js.map +1 -0
- package/openclaw.plugin.json +114 -0
- package/package.json +63 -0
- package/rules/builtin/README.md +139 -0
- package/rules/builtin/ai-services.yaml +70 -0
- package/rules/builtin/api-keys.yaml +64 -0
- package/rules/builtin/authentication.yaml +56 -0
- package/rules/builtin/aws-security.yaml +57 -0
- package/rules/builtin/azure-security.yaml +58 -0
- package/rules/builtin/cicd-security.yaml +64 -0
- package/rules/builtin/cloud-storage.yaml +64 -0
- package/rules/builtin/container-registry.yaml +55 -0
- package/rules/builtin/crypto-wallets.yaml +71 -0
- package/rules/builtin/database-nosql.yaml +58 -0
- package/rules/builtin/database-sql.yaml +62 -0
- package/rules/builtin/development-env.yaml +67 -0
- package/rules/builtin/docker.yaml +57 -0
- package/rules/builtin/filesystem.yaml +71 -0
- package/rules/builtin/financial-pci.yaml +61 -0
- package/rules/builtin/gcp-security.yaml +57 -0
- package/rules/builtin/git-operations.yaml +68 -0
- package/rules/builtin/healthcare-hipaa.yaml +64 -0
- package/rules/builtin/kubernetes.yaml +60 -0
- package/rules/builtin/messaging-services.yaml +53 -0
- package/rules/builtin/minimal.yaml +47 -0
- package/rules/builtin/mobile-development.yaml +61 -0
- package/rules/builtin/monitoring.yaml +63 -0
- package/rules/builtin/network-security.yaml +57 -0
- package/rules/builtin/package-managers.yaml +74 -0
- package/rules/builtin/payment-processing.yaml +66 -0
- package/rules/builtin/pii-protection.yaml +48 -0
- package/rules/builtin/production-strict.yaml +55 -0
- package/rules/builtin/secrets-management.yaml +63 -0
- package/rules/builtin/serverless.yaml +74 -0
- package/rules/builtin/ssh-security.yaml +66 -0
- package/rules/builtin/terraform.yaml +51 -0
- package/rules/builtin/web-security.yaml +62 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Exfiltration Detector
|
|
3
|
+
* Detects raw network commands used for data exfiltration (netcat, socat, /dev/tcp, etc.)
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Netcat patterns for data exfiltration
|
|
7
|
+
*/
|
|
8
|
+
const NETCAT_PATTERNS = [
|
|
9
|
+
// nc -e (execute shell - often used for reverse shells)
|
|
10
|
+
{
|
|
11
|
+
pattern: /\b(?:nc|netcat|ncat)\s+(?:[^|;]+\s+)?-e\s+(\S+)/i,
|
|
12
|
+
tool: 'netcat',
|
|
13
|
+
description: 'netcat with shell execution',
|
|
14
|
+
critical: true,
|
|
15
|
+
},
|
|
16
|
+
// nc with output redirection (sending file contents)
|
|
17
|
+
{
|
|
18
|
+
pattern: /\bcat\s+([^\s|]+)\s*\|\s*(?:nc|netcat|ncat)\s+([^\s]+)\s+(\d+)/i,
|
|
19
|
+
tool: 'netcat',
|
|
20
|
+
description: 'file piped to netcat',
|
|
21
|
+
},
|
|
22
|
+
// nc reading from file directly
|
|
23
|
+
{
|
|
24
|
+
pattern: /\b(?:nc|netcat|ncat)\s+(?:[^|;]+\s+)?<\s*([^\s]+)/i,
|
|
25
|
+
tool: 'netcat',
|
|
26
|
+
description: 'netcat with file input',
|
|
27
|
+
},
|
|
28
|
+
// Any command piped to nc with host and port
|
|
29
|
+
{
|
|
30
|
+
pattern: /\|\s*(?:nc|netcat|ncat)\s+(-[^\s]+\s+)*([^\s]+)\s+(\d+)/i,
|
|
31
|
+
tool: 'netcat',
|
|
32
|
+
description: 'piped data to netcat',
|
|
33
|
+
},
|
|
34
|
+
// nc -q (quiet mode - data transfer)
|
|
35
|
+
{
|
|
36
|
+
pattern: /\b(?:nc|netcat)\s+(?:[^|;]+\s+)?-q\s+\d+\s+([^\s]+)\s+(\d+)/i,
|
|
37
|
+
tool: 'netcat',
|
|
38
|
+
description: 'netcat data transfer',
|
|
39
|
+
},
|
|
40
|
+
// ncat with --send-only or --recv-only
|
|
41
|
+
{
|
|
42
|
+
pattern: /\bncat\s+(?:[^|;]+\s+)?--(?:send-only|exec)\s+/i,
|
|
43
|
+
tool: 'ncat',
|
|
44
|
+
description: 'ncat data transfer',
|
|
45
|
+
critical: true,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Bash /dev/tcp patterns (direct TCP connections)
|
|
50
|
+
*/
|
|
51
|
+
const DEV_TCP_PATTERNS = [
|
|
52
|
+
// exec /dev/tcp (check first as it's most critical)
|
|
53
|
+
{
|
|
54
|
+
pattern: /\bexec\s+\d+<>\/dev\/tcp\/([^\/]+)\/(\d+)/i,
|
|
55
|
+
tool: '/dev/tcp',
|
|
56
|
+
description: 'bash TCP file descriptor',
|
|
57
|
+
critical: true,
|
|
58
|
+
},
|
|
59
|
+
// Redirecting to /dev/tcp
|
|
60
|
+
{
|
|
61
|
+
pattern: />\s*\/dev\/tcp\/([^\/]+)\/(\d+)/i,
|
|
62
|
+
tool: '/dev/tcp',
|
|
63
|
+
description: 'bash TCP redirect (outbound)',
|
|
64
|
+
},
|
|
65
|
+
// Reading and sending via /dev/tcp
|
|
66
|
+
{
|
|
67
|
+
pattern: /\bcat\s+([^\s]+)\s*>\s*\/dev\/tcp\/([^\/]+)\/(\d+)/i,
|
|
68
|
+
tool: '/dev/tcp',
|
|
69
|
+
description: 'file sent via bash TCP',
|
|
70
|
+
},
|
|
71
|
+
// /dev/udp patterns
|
|
72
|
+
{
|
|
73
|
+
pattern: />\s*\/dev\/udp\/([^\/]+)\/(\d+)/i,
|
|
74
|
+
tool: '/dev/udp',
|
|
75
|
+
description: 'bash UDP redirect (outbound)',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
/**
|
|
79
|
+
* Socat patterns
|
|
80
|
+
*/
|
|
81
|
+
const SOCAT_PATTERNS = [
|
|
82
|
+
// socat sending file to TCP
|
|
83
|
+
{
|
|
84
|
+
pattern: /\bsocat\s+(?:[^|;]+\s+)?(?:FILE|OPEN):([^\s,]+)\s+TCP(?:4|6)?:([^:]+):(\d+)/i,
|
|
85
|
+
tool: 'socat',
|
|
86
|
+
description: 'socat file to TCP',
|
|
87
|
+
},
|
|
88
|
+
// socat with EXEC (shell execution)
|
|
89
|
+
{
|
|
90
|
+
pattern: /\bsocat\s+(?:[^|;]+\s+)?TCP(?:4|6)?:([^:]+):(\d+)\s+EXEC:/i,
|
|
91
|
+
tool: 'socat',
|
|
92
|
+
description: 'socat TCP with exec',
|
|
93
|
+
critical: true,
|
|
94
|
+
},
|
|
95
|
+
// socat stdin to TCP
|
|
96
|
+
{
|
|
97
|
+
pattern: /\bsocat\s+(?:[^|;]+\s+)?-\s+TCP(?:4|6)?:([^:]+):(\d+)/i,
|
|
98
|
+
tool: 'socat',
|
|
99
|
+
description: 'socat stdin to TCP',
|
|
100
|
+
},
|
|
101
|
+
// Piped data to socat
|
|
102
|
+
{
|
|
103
|
+
pattern: /\|\s*socat\s+(?:[^|;]+\s+)?-\s+TCP(?:4|6)?:([^:]+):(\d+)/i,
|
|
104
|
+
tool: 'socat',
|
|
105
|
+
description: 'piped data to socat',
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
/**
|
|
109
|
+
* Telnet patterns
|
|
110
|
+
*/
|
|
111
|
+
const TELNET_PATTERNS = [
|
|
112
|
+
// Piping data to telnet
|
|
113
|
+
{
|
|
114
|
+
pattern: /\|\s*telnet\s+([^\s]+)\s+(\d+)/i,
|
|
115
|
+
tool: 'telnet',
|
|
116
|
+
description: 'piped data to telnet',
|
|
117
|
+
},
|
|
118
|
+
// File redirected to telnet
|
|
119
|
+
{
|
|
120
|
+
pattern: /\btelnet\s+([^\s]+)\s+(\d+)\s*<\s*([^\s]+)/i,
|
|
121
|
+
tool: 'telnet',
|
|
122
|
+
description: 'file input to telnet',
|
|
123
|
+
},
|
|
124
|
+
// expect script with telnet
|
|
125
|
+
{
|
|
126
|
+
pattern: /\bexpect\s+.*telnet\s+([^\s]+)\s+(\d+)/i,
|
|
127
|
+
tool: 'telnet/expect',
|
|
128
|
+
description: 'automated telnet session',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
/**
|
|
132
|
+
* SSH/SCP exfiltration patterns
|
|
133
|
+
*/
|
|
134
|
+
const SSH_EXFIL_PATTERNS = [
|
|
135
|
+
// scp upload: local file to remote (local path first, then user@host:remote)
|
|
136
|
+
// Detect pattern like: scp /local/file user@host:/remote/
|
|
137
|
+
{
|
|
138
|
+
pattern: /\bscp\s+(?:-[^\s]+\s+)*([^\s@:]+)\s+(\S+@[^:\s]+):(\S*)/i,
|
|
139
|
+
tool: 'scp',
|
|
140
|
+
description: 'scp upload to remote',
|
|
141
|
+
},
|
|
142
|
+
// rsync upload: local to remote
|
|
143
|
+
{
|
|
144
|
+
pattern: /\brsync\s+(?:-[^\s]+\s+)*([^\s@:]+)\s+(\S+@[^:\s]+):(\S*)/i,
|
|
145
|
+
tool: 'rsync',
|
|
146
|
+
description: 'rsync upload to remote',
|
|
147
|
+
},
|
|
148
|
+
// ssh with piped input
|
|
149
|
+
{
|
|
150
|
+
pattern: /\bcat\s+([^\s|]+)\s*\|\s*ssh\s+([^@\s]+@)?([^\s]+)/i,
|
|
151
|
+
tool: 'ssh',
|
|
152
|
+
description: 'file piped to ssh',
|
|
153
|
+
},
|
|
154
|
+
// sftp put command
|
|
155
|
+
{
|
|
156
|
+
pattern: /\bsftp\s+(?:[^|;]+\s+)?.*\bput\s+([^\s]+)/i,
|
|
157
|
+
tool: 'sftp',
|
|
158
|
+
description: 'sftp file upload',
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
/**
|
|
162
|
+
* DNS exfiltration patterns
|
|
163
|
+
*/
|
|
164
|
+
const DNS_EXFIL_PATTERNS = [
|
|
165
|
+
// nslookup/dig with long subdomain (potential data encoding)
|
|
166
|
+
{
|
|
167
|
+
pattern: /\b(?:nslookup|dig|host)\s+([a-zA-Z0-9]{30,})\./i,
|
|
168
|
+
tool: 'dns',
|
|
169
|
+
description: 'potential DNS exfiltration',
|
|
170
|
+
},
|
|
171
|
+
// dig with TXT record query
|
|
172
|
+
{
|
|
173
|
+
pattern: /\bdig\s+(?:[^|;]+\s+)?TXT\s+([^\s]+)/i,
|
|
174
|
+
tool: 'dns/txt',
|
|
175
|
+
description: 'DNS TXT record query',
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
/**
|
|
179
|
+
* Other network exfiltration patterns
|
|
180
|
+
*/
|
|
181
|
+
const OTHER_NETWORK_PATTERNS = [
|
|
182
|
+
// xxd/hexdump to network
|
|
183
|
+
{
|
|
184
|
+
pattern: /\b(?:xxd|hexdump)\s+[^\|]+\|\s*(?:nc|netcat|ncat|curl)/i,
|
|
185
|
+
tool: 'hex-encoded',
|
|
186
|
+
description: 'hex-encoded network exfiltration',
|
|
187
|
+
},
|
|
188
|
+
// openssl s_client for data transfer
|
|
189
|
+
{
|
|
190
|
+
pattern: /\bopenssl\s+s_client\s+(?:[^|;]+\s+)?-connect\s+([^:]+):(\d+)/i,
|
|
191
|
+
tool: 'openssl',
|
|
192
|
+
description: 'openssl encrypted connection',
|
|
193
|
+
},
|
|
194
|
+
// Python network exfiltration
|
|
195
|
+
{
|
|
196
|
+
pattern: /\bsocket\.(?:connect|sendto|send)\s*\(/i,
|
|
197
|
+
tool: 'python-socket',
|
|
198
|
+
description: 'Python socket connection',
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
/**
|
|
202
|
+
* Extract host and port from match
|
|
203
|
+
*/
|
|
204
|
+
function extractDestination(match, _pattern) {
|
|
205
|
+
// Different patterns capture host/port in different positions
|
|
206
|
+
const groups = match.slice(1);
|
|
207
|
+
let host;
|
|
208
|
+
let port;
|
|
209
|
+
for (const group of groups) {
|
|
210
|
+
if (!group)
|
|
211
|
+
continue;
|
|
212
|
+
// Check if it looks like a port (all digits)
|
|
213
|
+
if (/^\d+$/.test(group)) {
|
|
214
|
+
port = group;
|
|
215
|
+
}
|
|
216
|
+
// Check if it looks like a host/IP
|
|
217
|
+
else if (/^[a-zA-Z0-9.-]+$/.test(group) && !group.match(/^\//) && group.length < 256) {
|
|
218
|
+
host = group;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return { host, port };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Match netcat patterns
|
|
225
|
+
*/
|
|
226
|
+
export function matchNetcatCommand(command) {
|
|
227
|
+
for (const { pattern, tool, description, critical } of NETCAT_PATTERNS) {
|
|
228
|
+
const match = command.match(pattern);
|
|
229
|
+
if (match) {
|
|
230
|
+
const { host, port } = extractDestination(match, { pattern, tool });
|
|
231
|
+
const dataSource = match[1] && !match[1].match(/^\d+$/) && !match[1].match(/^-/)
|
|
232
|
+
? match[1]
|
|
233
|
+
: undefined;
|
|
234
|
+
return {
|
|
235
|
+
matched: true,
|
|
236
|
+
command,
|
|
237
|
+
tool,
|
|
238
|
+
destination: host,
|
|
239
|
+
port,
|
|
240
|
+
dataSource,
|
|
241
|
+
confidence: critical ? 0.95 : 0.9,
|
|
242
|
+
description,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return { matched: false, confidence: 0 };
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Match /dev/tcp patterns
|
|
250
|
+
*/
|
|
251
|
+
export function matchDevTcpPattern(command) {
|
|
252
|
+
for (const entry of DEV_TCP_PATTERNS) {
|
|
253
|
+
const { pattern, tool, description } = entry;
|
|
254
|
+
const critical = 'critical' in entry ? entry.critical : false;
|
|
255
|
+
const match = command.match(pattern);
|
|
256
|
+
if (match) {
|
|
257
|
+
// For /dev/tcp, match[1] is typically the host, match[2] is the port
|
|
258
|
+
const host = match.find((m, i) => i > 0 && m && !m.match(/^\d+$/) && m.length < 256);
|
|
259
|
+
const port = match.find((m, i) => i > 0 && m && /^\d+$/.test(m));
|
|
260
|
+
return {
|
|
261
|
+
matched: true,
|
|
262
|
+
command,
|
|
263
|
+
tool,
|
|
264
|
+
destination: host,
|
|
265
|
+
port,
|
|
266
|
+
confidence: critical ? 0.95 : 0.9,
|
|
267
|
+
description,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return { matched: false, confidence: 0 };
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Match socat patterns
|
|
275
|
+
*/
|
|
276
|
+
export function matchSocatCommand(command) {
|
|
277
|
+
for (const { pattern, tool, description, critical } of SOCAT_PATTERNS) {
|
|
278
|
+
const match = command.match(pattern);
|
|
279
|
+
if (match) {
|
|
280
|
+
const { host, port } = extractDestination(match, { pattern, tool });
|
|
281
|
+
const dataSource = match[1] && !match[1].match(/^\d+$/) && !match[1].match(/^[a-zA-Z0-9.-]+$/)
|
|
282
|
+
? match[1]
|
|
283
|
+
: undefined;
|
|
284
|
+
return {
|
|
285
|
+
matched: true,
|
|
286
|
+
command,
|
|
287
|
+
tool,
|
|
288
|
+
destination: host,
|
|
289
|
+
port,
|
|
290
|
+
dataSource,
|
|
291
|
+
confidence: critical ? 0.95 : 0.85,
|
|
292
|
+
description,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return { matched: false, confidence: 0 };
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Match telnet patterns
|
|
300
|
+
*/
|
|
301
|
+
export function matchTelnetCommand(command) {
|
|
302
|
+
for (const { pattern, tool, description } of TELNET_PATTERNS) {
|
|
303
|
+
const match = command.match(pattern);
|
|
304
|
+
if (match) {
|
|
305
|
+
return {
|
|
306
|
+
matched: true,
|
|
307
|
+
command,
|
|
308
|
+
tool,
|
|
309
|
+
destination: match[1],
|
|
310
|
+
port: match[2],
|
|
311
|
+
dataSource: match[3],
|
|
312
|
+
confidence: 0.85,
|
|
313
|
+
description,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { matched: false, confidence: 0 };
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Match SSH/SCP exfiltration patterns
|
|
321
|
+
*/
|
|
322
|
+
export function matchSshExfiltration(command) {
|
|
323
|
+
for (const { pattern, tool, description } of SSH_EXFIL_PATTERNS) {
|
|
324
|
+
const match = command.match(pattern);
|
|
325
|
+
if (match) {
|
|
326
|
+
// Extract user@host
|
|
327
|
+
const userHost = match.find((m, i) => i > 0 && m && m.includes('@'));
|
|
328
|
+
const host = userHost?.split('@')[1] || match[2] || match[3];
|
|
329
|
+
return {
|
|
330
|
+
matched: true,
|
|
331
|
+
command,
|
|
332
|
+
tool,
|
|
333
|
+
destination: host,
|
|
334
|
+
dataSource: match[1],
|
|
335
|
+
confidence: 0.85,
|
|
336
|
+
description,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return { matched: false, confidence: 0 };
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Match DNS exfiltration patterns
|
|
344
|
+
*/
|
|
345
|
+
export function matchDnsExfiltration(command) {
|
|
346
|
+
for (const { pattern, tool, description } of DNS_EXFIL_PATTERNS) {
|
|
347
|
+
const match = command.match(pattern);
|
|
348
|
+
if (match) {
|
|
349
|
+
return {
|
|
350
|
+
matched: true,
|
|
351
|
+
command,
|
|
352
|
+
tool,
|
|
353
|
+
destination: match[1],
|
|
354
|
+
confidence: 0.7, // Lower confidence as this could be legitimate
|
|
355
|
+
description,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return { matched: false, confidence: 0 };
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Match other network exfiltration patterns
|
|
363
|
+
*/
|
|
364
|
+
export function matchOtherNetworkPattern(command) {
|
|
365
|
+
for (const { pattern, tool, description } of OTHER_NETWORK_PATTERNS) {
|
|
366
|
+
const match = command.match(pattern);
|
|
367
|
+
if (match) {
|
|
368
|
+
return {
|
|
369
|
+
matched: true,
|
|
370
|
+
command,
|
|
371
|
+
tool,
|
|
372
|
+
destination: match[1],
|
|
373
|
+
port: match[2],
|
|
374
|
+
confidence: 0.8,
|
|
375
|
+
description,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return { matched: false, confidence: 0 };
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Comprehensive network exfiltration matching
|
|
383
|
+
*/
|
|
384
|
+
export function matchNetworkExfiltration(text) {
|
|
385
|
+
// Try netcat patterns first
|
|
386
|
+
const ncResult = matchNetcatCommand(text);
|
|
387
|
+
if (ncResult.matched) {
|
|
388
|
+
return ncResult;
|
|
389
|
+
}
|
|
390
|
+
// Try /dev/tcp patterns
|
|
391
|
+
const devTcpResult = matchDevTcpPattern(text);
|
|
392
|
+
if (devTcpResult.matched) {
|
|
393
|
+
return devTcpResult;
|
|
394
|
+
}
|
|
395
|
+
// Try socat patterns
|
|
396
|
+
const socatResult = matchSocatCommand(text);
|
|
397
|
+
if (socatResult.matched) {
|
|
398
|
+
return socatResult;
|
|
399
|
+
}
|
|
400
|
+
// Try telnet patterns
|
|
401
|
+
const telnetResult = matchTelnetCommand(text);
|
|
402
|
+
if (telnetResult.matched) {
|
|
403
|
+
return telnetResult;
|
|
404
|
+
}
|
|
405
|
+
// Try SSH/SCP patterns
|
|
406
|
+
const sshResult = matchSshExfiltration(text);
|
|
407
|
+
if (sshResult.matched) {
|
|
408
|
+
return sshResult;
|
|
409
|
+
}
|
|
410
|
+
// Try DNS exfiltration patterns
|
|
411
|
+
const dnsResult = matchDnsExfiltration(text);
|
|
412
|
+
if (dnsResult.matched) {
|
|
413
|
+
return dnsResult;
|
|
414
|
+
}
|
|
415
|
+
// Try other patterns
|
|
416
|
+
const otherResult = matchOtherNetworkPattern(text);
|
|
417
|
+
if (otherResult.matched) {
|
|
418
|
+
return otherResult;
|
|
419
|
+
}
|
|
420
|
+
return { matched: false, confidence: 0 };
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Network exfiltration detector class
|
|
424
|
+
*/
|
|
425
|
+
export class NetworkDetector {
|
|
426
|
+
severity;
|
|
427
|
+
constructor(severity = 'high') {
|
|
428
|
+
this.severity = severity;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Extract text content from tool context
|
|
432
|
+
*/
|
|
433
|
+
extractContent(context) {
|
|
434
|
+
const input = context.toolInput;
|
|
435
|
+
// Direct command field
|
|
436
|
+
if (typeof input.command === 'string') {
|
|
437
|
+
return input.command;
|
|
438
|
+
}
|
|
439
|
+
// Shell/bash command field
|
|
440
|
+
if (typeof input.shell === 'string') {
|
|
441
|
+
return input.shell;
|
|
442
|
+
}
|
|
443
|
+
if (typeof input.bash === 'string') {
|
|
444
|
+
return input.bash;
|
|
445
|
+
}
|
|
446
|
+
// Script field
|
|
447
|
+
if (typeof input.script === 'string') {
|
|
448
|
+
return input.script;
|
|
449
|
+
}
|
|
450
|
+
// Code field
|
|
451
|
+
if (typeof input.code === 'string') {
|
|
452
|
+
return input.code;
|
|
453
|
+
}
|
|
454
|
+
// Text content
|
|
455
|
+
if (typeof input.text === 'string') {
|
|
456
|
+
return input.text;
|
|
457
|
+
}
|
|
458
|
+
// Content field
|
|
459
|
+
if (typeof input.content === 'string') {
|
|
460
|
+
return input.content;
|
|
461
|
+
}
|
|
462
|
+
// Body field
|
|
463
|
+
if (typeof input.body === 'string') {
|
|
464
|
+
return input.body;
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
detect(context) {
|
|
469
|
+
const content = this.extractContent(context);
|
|
470
|
+
if (!content) {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
const result = matchNetworkExfiltration(content);
|
|
474
|
+
if (!result.matched) {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
const destInfo = result.destination
|
|
478
|
+
? ` to ${result.destination}${result.port ? ':' + result.port : ''}`
|
|
479
|
+
: '';
|
|
480
|
+
const srcInfo = result.dataSource ? ` (source: ${result.dataSource})` : '';
|
|
481
|
+
return {
|
|
482
|
+
detected: true,
|
|
483
|
+
category: 'exfiltration',
|
|
484
|
+
severity: this.severity,
|
|
485
|
+
confidence: result.confidence,
|
|
486
|
+
reason: `Network exfiltration detected: ${result.description || result.tool}${destInfo}${srcInfo}`,
|
|
487
|
+
metadata: {
|
|
488
|
+
method: 'network',
|
|
489
|
+
destination: result.destination
|
|
490
|
+
? (result.port ? `${result.destination}:${result.port}` : result.destination)
|
|
491
|
+
: undefined,
|
|
492
|
+
dataSource: result.dataSource,
|
|
493
|
+
command: result.command,
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Create a network detector with the given severity
|
|
500
|
+
*/
|
|
501
|
+
export function createNetworkDetector(severity = 'high') {
|
|
502
|
+
return new NetworkDetector(severity);
|
|
503
|
+
}
|
|
504
|
+
//# sourceMappingURL=network-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-detector.js","sourceRoot":"","sources":["../../../../src/detectors/exfiltration/network-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,wDAAwD;IACxD;QACE,OAAO,EAAE,kDAAkD;QAC3D,IAAI,EAAE,QAAQ;QACd,WAAW,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I,GAAG,QAAQ,GAAG,OAAO,EAAE;YAClG,QAAQ,EAAE;gBACR,MAAM,EAAE,SAAS;gBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC7B,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;oBAC7E,CAAC,CAAC,SAAS;gBACb,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB;SACF,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAqB,MAAM;IAC/D,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exfiltration Detector Types
|
|
3
|
+
* Type definitions for detecting data exfiltration attempts
|
|
4
|
+
*/
|
|
5
|
+
import type { Severity, Action } from '../../config/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Detection context passed to detectors
|
|
8
|
+
*/
|
|
9
|
+
export interface DetectionContext {
|
|
10
|
+
/** Name of the tool being invoked */
|
|
11
|
+
toolName: string;
|
|
12
|
+
/** Input parameters to the tool */
|
|
13
|
+
toolInput: Record<string, unknown>;
|
|
14
|
+
/** URL being accessed (for browser/navigation tools) */
|
|
15
|
+
url?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Method of exfiltration detected
|
|
19
|
+
*/
|
|
20
|
+
export type ExfiltrationMethod = 'http' | 'cloud' | 'network' | 'encoded';
|
|
21
|
+
/**
|
|
22
|
+
* Result of an exfiltration detection
|
|
23
|
+
*/
|
|
24
|
+
export interface ExfiltrationDetectionResult {
|
|
25
|
+
/** Whether exfiltration was detected */
|
|
26
|
+
detected: boolean;
|
|
27
|
+
/** Category of the detection */
|
|
28
|
+
category: 'exfiltration';
|
|
29
|
+
/** Severity level of the detection */
|
|
30
|
+
severity: Severity;
|
|
31
|
+
/** Confidence score from 0 to 1 */
|
|
32
|
+
confidence: number;
|
|
33
|
+
/** Human-readable reason for the detection */
|
|
34
|
+
reason: string;
|
|
35
|
+
/** Additional metadata about the detection */
|
|
36
|
+
metadata?: {
|
|
37
|
+
/** Method of exfiltration */
|
|
38
|
+
method: ExfiltrationMethod;
|
|
39
|
+
/** Destination URL, IP, or hostname */
|
|
40
|
+
destination?: string;
|
|
41
|
+
/** What data is being sent */
|
|
42
|
+
dataSource?: string;
|
|
43
|
+
/** The command that triggered detection */
|
|
44
|
+
command?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Configuration for the exfiltration detector
|
|
49
|
+
*/
|
|
50
|
+
export interface ExfiltrationDetectorConfig {
|
|
51
|
+
/** Whether the detector is enabled */
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
/** Severity level to assign to detections */
|
|
54
|
+
severity: Severity;
|
|
55
|
+
/** Action to take when exfiltration is detected */
|
|
56
|
+
action: Action;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Interface for the main exfiltration detector
|
|
60
|
+
*/
|
|
61
|
+
export interface ExfiltrationDetector {
|
|
62
|
+
/**
|
|
63
|
+
* Detect exfiltration attempts
|
|
64
|
+
* @param context Detection context with tool information
|
|
65
|
+
* @returns Detection result
|
|
66
|
+
*/
|
|
67
|
+
detect(context: DetectionContext): Promise<ExfiltrationDetectionResult>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Interface for sub-detectors (http, cloud, network)
|
|
71
|
+
*/
|
|
72
|
+
export interface SubDetector {
|
|
73
|
+
/**
|
|
74
|
+
* Check if the given context matches this detector's patterns
|
|
75
|
+
* @param context Detection context
|
|
76
|
+
* @returns Detection result or null if no match
|
|
77
|
+
*/
|
|
78
|
+
detect(context: DetectionContext): ExfiltrationDetectionResult | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* HTTP exfiltration match result
|
|
82
|
+
*/
|
|
83
|
+
export interface HttpMatchResult {
|
|
84
|
+
/** Whether a match was found */
|
|
85
|
+
matched: boolean;
|
|
86
|
+
/** The command or code that matched */
|
|
87
|
+
command?: string;
|
|
88
|
+
/** The HTTP method used (POST, PUT) */
|
|
89
|
+
httpMethod?: string;
|
|
90
|
+
/** The destination URL */
|
|
91
|
+
destination?: string;
|
|
92
|
+
/** What data is being sent */
|
|
93
|
+
dataSource?: string;
|
|
94
|
+
/** Confidence score */
|
|
95
|
+
confidence: number;
|
|
96
|
+
/** Description of the exfiltration attempt */
|
|
97
|
+
description?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Cloud upload match result
|
|
101
|
+
*/
|
|
102
|
+
export interface CloudUploadMatchResult {
|
|
103
|
+
/** Whether a match was found */
|
|
104
|
+
matched: boolean;
|
|
105
|
+
/** The command that matched */
|
|
106
|
+
command?: string;
|
|
107
|
+
/** The cloud provider (aws, gcp, azure) */
|
|
108
|
+
provider?: string;
|
|
109
|
+
/** The operation detected (cp, sync) */
|
|
110
|
+
operation?: string;
|
|
111
|
+
/** The destination (S3 bucket, GCS bucket, etc.) */
|
|
112
|
+
destination?: string;
|
|
113
|
+
/** The source file/directory being uploaded */
|
|
114
|
+
dataSource?: string;
|
|
115
|
+
/** Confidence score */
|
|
116
|
+
confidence: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Network exfiltration match result
|
|
120
|
+
*/
|
|
121
|
+
export interface NetworkMatchResult {
|
|
122
|
+
/** Whether a match was found */
|
|
123
|
+
matched: boolean;
|
|
124
|
+
/** The command that matched */
|
|
125
|
+
command?: string;
|
|
126
|
+
/** The tool used (nc, netcat, socat, etc.) */
|
|
127
|
+
tool?: string;
|
|
128
|
+
/** The destination host/IP */
|
|
129
|
+
destination?: string;
|
|
130
|
+
/** The port being used */
|
|
131
|
+
port?: string;
|
|
132
|
+
/** What data is being sent */
|
|
133
|
+
dataSource?: string;
|
|
134
|
+
/** Confidence score */
|
|
135
|
+
confidence: number;
|
|
136
|
+
/** Description of the exfiltration attempt */
|
|
137
|
+
description?: string;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/detectors/exfiltration/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,QAAQ,EAAE,cAAc,CAAC;IACzB,sCAAsC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE;QACT,6BAA6B;QAC7B,MAAM,EAAE,kBAAkB,CAAC;QAC3B,uCAAuC;QACvC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,8BAA8B;QAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,2CAA2C;QAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;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AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/detectors/exfiltration/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|