erosolar-cli 1.5.2 → 1.5.4
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/config/security-deployment.json +54 -0
- package/dist/bin/adapters/node/index.js +33 -0
- package/dist/bin/adapters/types.js +1 -0
- package/dist/bin/alpha-zero/agentWrapper.js +165 -0
- package/dist/bin/alpha-zero/codeEvaluator.js +272 -0
- package/dist/bin/alpha-zero/competitiveRunner.js +219 -0
- package/dist/bin/alpha-zero/index.js +98 -0
- package/dist/bin/alpha-zero/introspection.js +298 -0
- package/dist/bin/alpha-zero/metricsTracker.js +207 -0
- package/dist/bin/alpha-zero/security/core.js +269 -0
- package/dist/bin/alpha-zero/security/google.js +308 -0
- package/dist/bin/alpha-zero/security/googleLoader.js +40 -0
- package/dist/bin/alpha-zero/security/index.js +31 -0
- package/dist/bin/alpha-zero/security/simulation.js +274 -0
- package/dist/bin/alpha-zero/selfModification.js +231 -0
- package/dist/bin/alpha-zero/types.js +30 -0
- package/dist/bin/bin/erosolar-optimized.js +205 -0
- package/dist/bin/capabilities/agentSpawningCapability.js +116 -0
- package/dist/bin/capabilities/bashCapability.js +22 -0
- package/dist/bin/capabilities/cloudCapability.js +36 -0
- package/dist/bin/capabilities/codeAnalysisCapability.js +22 -0
- package/dist/bin/capabilities/codeQualityCapability.js +23 -0
- package/dist/bin/capabilities/dependencySecurityCapability.js +22 -0
- package/dist/bin/capabilities/devCapability.js +22 -0
- package/dist/bin/capabilities/editCapability.js +28 -0
- package/dist/bin/capabilities/emailCapability.js +20 -0
- package/dist/bin/capabilities/enhancedGitCapability.js +221 -0
- package/dist/bin/capabilities/filesystemCapability.js +22 -0
- package/dist/bin/capabilities/globCapability.js +28 -0
- package/dist/bin/capabilities/interactionCapability.js +20 -0
- package/dist/bin/capabilities/learnCapability.js +22 -0
- package/dist/bin/capabilities/mcpCapability.js +20 -0
- package/dist/bin/capabilities/notebookCapability.js +28 -0
- package/dist/bin/capabilities/planningCapability.js +27 -0
- package/dist/bin/capabilities/refactoringCapability.js +23 -0
- package/dist/bin/capabilities/repoChecksCapability.js +22 -0
- package/dist/bin/capabilities/searchCapability.js +22 -0
- package/dist/bin/capabilities/skillCapability.js +76 -0
- package/dist/bin/capabilities/taskManagementCapability.js +20 -0
- package/dist/bin/capabilities/testingCapability.js +23 -0
- package/dist/bin/capabilities/toolManifest.js +159 -0
- package/dist/bin/capabilities/toolRegistry.js +114 -0
- package/dist/bin/capabilities/webCapability.js +20 -0
- package/dist/bin/config.js +139 -0
- package/dist/bin/contracts/v1/agent.js +7 -0
- package/dist/bin/contracts/v1/agentProfileManifest.js +8 -0
- package/dist/bin/contracts/v1/agentRules.js +9 -0
- package/dist/bin/contracts/v1/toolAccess.js +8 -0
- package/dist/bin/core/agent.js +362 -0
- package/dist/bin/core/agentProfileManifest.js +187 -0
- package/dist/bin/core/agentProfiles.js +34 -0
- package/dist/bin/core/agentRulebook.js +135 -0
- package/dist/bin/core/agentSchemaLoader.js +233 -0
- package/dist/bin/core/contextManager.js +412 -0
- package/dist/bin/core/contextWindow.js +122 -0
- package/dist/bin/core/customCommands.js +80 -0
- package/dist/bin/core/errors/apiKeyErrors.js +114 -0
- package/dist/bin/core/errors/errorTypes.js +340 -0
- package/dist/bin/core/errors/safetyValidator.js +304 -0
- package/dist/bin/core/errors.js +32 -0
- package/dist/bin/core/modelDiscovery.js +755 -0
- package/dist/bin/core/preferences.js +224 -0
- package/dist/bin/core/schemaValidator.js +92 -0
- package/dist/bin/core/secretStore.js +199 -0
- package/dist/bin/core/sessionStore.js +187 -0
- package/dist/bin/core/toolRuntime.js +290 -0
- package/dist/bin/core/types.js +1 -0
- package/dist/bin/erosolar-optimized.d.ts +12 -0
- package/dist/bin/erosolar-optimized.d.ts.map +1 -0
- package/dist/bin/erosolar-optimized.js +239 -0
- package/dist/bin/erosolar-optimized.js.map +1 -0
- package/dist/bin/erosolar.js +14 -0
- package/dist/bin/erosolar.js.map +1 -1
- package/dist/bin/headless/headlessApp.js +172 -0
- package/dist/bin/mcp/config.js +202 -0
- package/dist/bin/mcp/stdioClient.js +172 -0
- package/dist/bin/mcp/toolBridge.js +104 -0
- package/dist/bin/mcp/types.js +1 -0
- package/dist/bin/plugins/index.js +113 -0
- package/dist/bin/plugins/providers/anthropic/index.js +25 -0
- package/dist/bin/plugins/providers/deepseek/index.js +24 -0
- package/dist/bin/plugins/providers/google/index.js +26 -0
- package/dist/bin/plugins/providers/index.js +19 -0
- package/dist/bin/plugins/providers/ollama/index.js +59 -0
- package/dist/bin/plugins/providers/openai/index.js +26 -0
- package/dist/bin/plugins/providers/xai/index.js +24 -0
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +8 -0
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +13 -0
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +13 -0
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +13 -0
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +13 -0
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +13 -0
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +11 -0
- package/dist/bin/plugins/tools/development/devPlugin.js +13 -0
- package/dist/bin/plugins/tools/edit/editPlugin.js +14 -0
- package/dist/bin/plugins/tools/email/emailPlugin.js +11 -0
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +8 -0
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +13 -0
- package/dist/bin/plugins/tools/glob/globPlugin.js +14 -0
- package/dist/bin/plugins/tools/index.js +2 -0
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +11 -0
- package/dist/bin/plugins/tools/learn/learnPlugin.js +13 -0
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +8 -0
- package/dist/bin/plugins/tools/nodeDefaults.js +56 -0
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +14 -0
- package/dist/bin/plugins/tools/planning/planningPlugin.js +14 -0
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +11 -0
- package/dist/bin/plugins/tools/registry.js +57 -0
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +13 -0
- package/dist/bin/plugins/tools/skills/skillPlugin.js +8 -0
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +11 -0
- package/dist/bin/plugins/tools/testing/testingPlugin.js +11 -0
- package/dist/bin/plugins/tools/web/webPlugin.js +11 -0
- package/dist/bin/providers/anthropicProvider.js +329 -0
- package/dist/bin/providers/googleProvider.js +203 -0
- package/dist/bin/providers/openaiChatCompletionsProvider.js +208 -0
- package/dist/bin/providers/openaiResponsesProvider.js +249 -0
- package/dist/bin/providers/providerFactory.js +24 -0
- package/dist/bin/runtime/agentController.js +321 -0
- package/dist/bin/runtime/agentHost.js +153 -0
- package/dist/bin/runtime/agentSession.js +195 -0
- package/dist/bin/runtime/node.js +10 -0
- package/dist/bin/runtime/universal.js +28 -0
- package/dist/bin/shell/bracketedPasteManager.js +350 -0
- package/dist/bin/shell/fileChangeTracker.js +65 -0
- package/dist/bin/shell/interactiveShell.js +2908 -0
- package/dist/bin/shell/liveStatus.js +78 -0
- package/dist/bin/shell/shellApp.js +290 -0
- package/dist/bin/shell/systemPrompt.js +60 -0
- package/dist/bin/shell/updateManager.js +108 -0
- package/dist/bin/skills/skillRepository.js +236 -0
- package/dist/bin/skills/types.js +1 -0
- package/dist/bin/subagents/taskRunner.js +269 -0
- package/dist/bin/tools/backgroundBashTools.js +211 -0
- package/dist/bin/tools/bashTools.js +159 -0
- package/dist/bin/tools/cloudTools.js +864 -0
- package/dist/bin/tools/codeAnalysisTools.js +641 -0
- package/dist/bin/tools/codeQualityTools.js +294 -0
- package/dist/bin/tools/dependencyTools.js +282 -0
- package/dist/bin/tools/devTools.js +238 -0
- package/dist/bin/tools/diffUtils.js +137 -0
- package/dist/bin/tools/editTools.js +134 -0
- package/dist/bin/tools/emailTools.js +448 -0
- package/dist/bin/tools/fileTools.js +282 -0
- package/dist/bin/tools/globTools.js +173 -0
- package/dist/bin/tools/grepTools.js +332 -0
- package/dist/bin/tools/interactionTools.js +170 -0
- package/dist/bin/tools/learnTools.js +1818 -0
- package/dist/bin/tools/notebookEditTools.js +196 -0
- package/dist/bin/tools/planningTools.js +46 -0
- package/dist/bin/tools/refactoringTools.js +293 -0
- package/dist/bin/tools/repoChecksTools.js +160 -0
- package/dist/bin/tools/searchTools.js +206 -0
- package/dist/bin/tools/skillTools.js +177 -0
- package/dist/bin/tools/taskManagementTools.js +156 -0
- package/dist/bin/tools/testingTools.js +232 -0
- package/dist/bin/tools/webTools.js +480 -0
- package/dist/bin/ui/ShellUIAdapter.js +459 -0
- package/dist/bin/ui/UnifiedUIController.js +183 -0
- package/dist/bin/ui/animation/AnimationScheduler.js +430 -0
- package/dist/bin/ui/codeHighlighter.js +854 -0
- package/dist/bin/ui/designSystem.js +121 -0
- package/dist/bin/ui/display.js +1222 -0
- package/dist/bin/ui/interrupts/InterruptManager.js +437 -0
- package/dist/bin/ui/layout.js +139 -0
- package/dist/bin/ui/orchestration/StatusOrchestrator.js +403 -0
- package/dist/bin/ui/outputMode.js +38 -0
- package/dist/bin/ui/persistentPrompt.js +183 -0
- package/dist/bin/ui/richText.js +338 -0
- package/dist/bin/ui/shortcutsHelp.js +87 -0
- package/dist/bin/ui/telemetry/UITelemetry.js +443 -0
- package/dist/bin/ui/textHighlighter.js +210 -0
- package/dist/bin/ui/theme.js +116 -0
- package/dist/bin/ui/toolDisplay.js +423 -0
- package/dist/bin/ui/toolDisplayAdapter.js +357 -0
- package/dist/bin/workspace.js +106 -0
- package/dist/bin/workspace.validator.js +213 -0
- package/dist/capabilities/cloudCapability.d.ts +13 -0
- package/dist/capabilities/cloudCapability.d.ts.map +1 -0
- package/dist/capabilities/cloudCapability.js +38 -0
- package/dist/capabilities/cloudCapability.js.map +1 -0
- package/dist/capabilities/index.d.ts +1 -0
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +1 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/offensiveSecurityCapability.d.ts +26 -0
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/offensiveSecurityCapability.js +58 -0
- package/dist/capabilities/offensiveSecurityCapability.js.map +1 -0
- package/dist/capabilities/realSecurityCapability.d.ts +26 -0
- package/dist/capabilities/realSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/realSecurityCapability.js +53 -0
- package/dist/capabilities/realSecurityCapability.js.map +1 -0
- package/dist/capabilities/securityCapability.d.ts +32 -0
- package/dist/capabilities/securityCapability.d.ts.map +1 -0
- package/dist/capabilities/securityCapability.js +57 -0
- package/dist/capabilities/securityCapability.js.map +1 -0
- package/dist/capabilities/ultimateSecurityCapability.d.ts +42 -0
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/ultimateSecurityCapability.js +96 -0
- package/dist/capabilities/ultimateSecurityCapability.js.map +1 -0
- package/dist/core/LazyLoader.d.ts +129 -0
- package/dist/core/LazyLoader.d.ts.map +1 -0
- package/dist/core/LazyLoader.js +240 -0
- package/dist/core/LazyLoader.js.map +1 -0
- package/dist/core/intelligenceTools.d.ts +19 -0
- package/dist/core/intelligenceTools.d.ts.map +1 -0
- package/dist/core/intelligenceTools.js +453 -0
- package/dist/core/intelligenceTools.js.map +1 -0
- package/dist/core/operationalTools.d.ts +19 -0
- package/dist/core/operationalTools.d.ts.map +1 -0
- package/dist/core/operationalTools.js +467 -0
- package/dist/core/operationalTools.js.map +1 -0
- package/dist/offensive/core/offensive-engine.d.ts +171 -0
- package/dist/offensive/core/offensive-engine.d.ts.map +1 -0
- package/dist/offensive/core/offensive-engine.js +345 -0
- package/dist/offensive/core/offensive-engine.js.map +1 -0
- package/dist/offensive/core/offensive-integration.d.ts +129 -0
- package/dist/offensive/core/offensive-integration.d.ts.map +1 -0
- package/dist/offensive/core/offensive-integration.js +364 -0
- package/dist/offensive/core/offensive-integration.js.map +1 -0
- package/dist/offensive/core/offensive-tools.d.ts +55 -0
- package/dist/offensive/core/offensive-tools.d.ts.map +1 -0
- package/dist/offensive/core/offensive-tools.js +438 -0
- package/dist/offensive/core/offensive-tools.js.map +1 -0
- package/dist/offensive/offensive-cli.d.ts +48 -0
- package/dist/offensive/offensive-cli.d.ts.map +1 -0
- package/dist/offensive/offensive-cli.js +233 -0
- package/dist/offensive/offensive-cli.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts +3 -0
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js +14 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js.map +1 -0
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.js +2 -0
- package/dist/plugins/tools/nodeDefaults.js.map +1 -1
- package/dist/security/advanced-persistence-research.d.ts +92 -0
- package/dist/security/advanced-persistence-research.d.ts.map +1 -0
- package/dist/security/advanced-persistence-research.js +195 -0
- package/dist/security/advanced-persistence-research.js.map +1 -0
- package/dist/security/apt-simulation-cli.d.ts +57 -0
- package/dist/security/apt-simulation-cli.d.ts.map +1 -0
- package/dist/security/apt-simulation-cli.js +278 -0
- package/dist/security/apt-simulation-cli.js.map +1 -0
- package/dist/security/apt-simulation-engine-complete.d.ts +97 -0
- package/dist/security/apt-simulation-engine-complete.d.ts.map +1 -0
- package/dist/security/apt-simulation-engine-complete.js +441 -0
- package/dist/security/apt-simulation-engine-complete.js.map +1 -0
- package/dist/security/apt-simulation-engine.d.ts +97 -0
- package/dist/security/apt-simulation-engine.d.ts.map +1 -0
- package/dist/security/apt-simulation-engine.js +441 -0
- package/dist/security/apt-simulation-engine.js.map +1 -0
- package/dist/security/assessment/vulnerabilityAssessment.d.ts +104 -0
- package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +1 -0
- package/dist/security/assessment/vulnerabilityAssessment.js +315 -0
- package/dist/security/assessment/vulnerabilityAssessment.js.map +1 -0
- package/dist/security/authorization/securityAuthorization.d.ts +88 -0
- package/dist/security/authorization/securityAuthorization.d.ts.map +1 -0
- package/dist/security/authorization/securityAuthorization.js +172 -0
- package/dist/security/authorization/securityAuthorization.js.map +1 -0
- package/dist/security/authorization.d.ts +45 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/authorization.js +128 -0
- package/dist/security/authorization.js.map +1 -0
- package/dist/security/comprehensive-security-research.d.ts +84 -0
- package/dist/security/comprehensive-security-research.d.ts.map +1 -0
- package/dist/security/comprehensive-security-research.js +211 -0
- package/dist/security/comprehensive-security-research.js.map +1 -0
- package/dist/security/offensive/exploitationEngine.d.ts +54 -0
- package/dist/security/offensive/exploitationEngine.d.ts.map +1 -0
- package/dist/security/offensive/exploitationEngine.js +263 -0
- package/dist/security/offensive/exploitationEngine.js.map +1 -0
- package/dist/security/persistence-analyzer.d.ts +56 -0
- package/dist/security/persistence-analyzer.d.ts.map +1 -0
- package/dist/security/persistence-analyzer.js +187 -0
- package/dist/security/persistence-analyzer.js.map +1 -0
- package/dist/security/persistence-cli.d.ts +36 -0
- package/dist/security/persistence-cli.d.ts.map +1 -0
- package/dist/security/persistence-cli.js +160 -0
- package/dist/security/persistence-cli.js.map +1 -0
- package/dist/security/persistence-research.d.ts +100 -0
- package/dist/security/persistence-research.d.ts.map +1 -0
- package/dist/security/persistence-research.js +372 -0
- package/dist/security/persistence-research.js.map +1 -0
- package/dist/security/real/networkExploitation.d.ts +92 -0
- package/dist/security/real/networkExploitation.d.ts.map +1 -0
- package/dist/security/real/networkExploitation.js +316 -0
- package/dist/security/real/networkExploitation.js.map +1 -0
- package/dist/security/real/persistenceImplementation.d.ts +62 -0
- package/dist/security/real/persistenceImplementation.d.ts.map +1 -0
- package/dist/security/real/persistenceImplementation.js +323 -0
- package/dist/security/real/persistenceImplementation.js.map +1 -0
- package/dist/security/real/vulnerabilityScanner.d.ts +73 -0
- package/dist/security/real/vulnerabilityScanner.d.ts.map +1 -0
- package/dist/security/real/vulnerabilityScanner.js +341 -0
- package/dist/security/real/vulnerabilityScanner.js.map +1 -0
- package/dist/security/research/persistenceResearch.d.ts +97 -0
- package/dist/security/research/persistenceResearch.d.ts.map +1 -0
- package/dist/security/research/persistenceResearch.js +282 -0
- package/dist/security/research/persistenceResearch.js.map +1 -0
- package/dist/security/security-testing-framework.d.ts +120 -0
- package/dist/security/security-testing-framework.d.ts.map +1 -0
- package/dist/security/security-testing-framework.js +372 -0
- package/dist/security/security-testing-framework.js.map +1 -0
- package/dist/security/simulation/attackSimulation.d.ts +93 -0
- package/dist/security/simulation/attackSimulation.d.ts.map +1 -0
- package/dist/security/simulation/attackSimulation.js +341 -0
- package/dist/security/simulation/attackSimulation.js.map +1 -0
- package/dist/shell/bracketedPasteManager.d.ts +76 -0
- package/dist/shell/bracketedPasteManager.d.ts.map +1 -1
- package/dist/shell/bracketedPasteManager.js +267 -9
- package/dist/shell/bracketedPasteManager.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +34 -1
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +304 -24
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/taskCompletionDetector.d.ts +101 -0
- package/dist/shell/taskCompletionDetector.d.ts.map +1 -0
- package/dist/shell/taskCompletionDetector.js +343 -0
- package/dist/shell/taskCompletionDetector.js.map +1 -0
- package/dist/tools/cloudTools.d.ts +57 -0
- package/dist/tools/cloudTools.d.ts.map +1 -0
- package/dist/tools/cloudTools.js +865 -0
- package/dist/tools/cloudTools.js.map +1 -0
- package/dist/tools/enhancedSecurityTools.d.ts +19 -0
- package/dist/tools/enhancedSecurityTools.d.ts.map +1 -0
- package/dist/tools/enhancedSecurityTools.js +215 -0
- package/dist/tools/enhancedSecurityTools.js.map +1 -0
- package/dist/tools/offensiveSecurityTools.d.ts +16 -0
- package/dist/tools/offensiveSecurityTools.d.ts.map +1 -0
- package/dist/tools/offensiveSecurityTools.js +285 -0
- package/dist/tools/offensiveSecurityTools.js.map +1 -0
- package/dist/tools/realSecurityTools.d.ts +18 -0
- package/dist/tools/realSecurityTools.d.ts.map +1 -0
- package/dist/tools/realSecurityTools.js +468 -0
- package/dist/tools/realSecurityTools.js.map +1 -0
- package/dist/tools/securityTools.d.ts +20 -0
- package/dist/tools/securityTools.d.ts.map +1 -0
- package/dist/tools/securityTools.js +449 -0
- package/dist/tools/securityTools.js.map +1 -0
- package/package.json +27 -12
- package/scripts/deploy-security-capabilities.js +178 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Infrastructure Persistence Vector Research
|
|
3
|
+
*
|
|
4
|
+
* OPTIONAL MODULE - Only loaded when Google security research is enabled.
|
|
5
|
+
*
|
|
6
|
+
* Provides research tools for identifying persistence mechanisms
|
|
7
|
+
* in Google Cloud Platform and Google Workspace environments.
|
|
8
|
+
*
|
|
9
|
+
* AUTHORIZATION: Designed for authorized red team engagements and
|
|
10
|
+
* penetration testing of Google infrastructure under contract.
|
|
11
|
+
*
|
|
12
|
+
* Principal Investigator: Bo Shang
|
|
13
|
+
* Framework: erosolar-cli
|
|
14
|
+
*/
|
|
15
|
+
import { AuthorizationScope } from './core.js';
|
|
16
|
+
/**
|
|
17
|
+
* Google services for persistence research
|
|
18
|
+
*/
|
|
19
|
+
export var GoogleService;
|
|
20
|
+
(function (GoogleService) {
|
|
21
|
+
// Google Cloud Platform
|
|
22
|
+
GoogleService["GCP_COMPUTE"] = "gcp_compute_engine";
|
|
23
|
+
GoogleService["GCP_GKE"] = "gcp_kubernetes_engine";
|
|
24
|
+
GoogleService["GCP_CLOUD_FUNCTIONS"] = "gcp_cloud_functions";
|
|
25
|
+
GoogleService["GCP_IAM"] = "gcp_iam";
|
|
26
|
+
GoogleService["GCP_SERVICE_ACCOUNTS"] = "gcp_service_accounts";
|
|
27
|
+
GoogleService["GCP_CLOUD_STORAGE"] = "gcp_cloud_storage";
|
|
28
|
+
GoogleService["GCP_SECRETS_MANAGER"] = "gcp_secrets_manager";
|
|
29
|
+
// Google Workspace
|
|
30
|
+
GoogleService["WORKSPACE_GMAIL"] = "workspace_gmail";
|
|
31
|
+
GoogleService["WORKSPACE_DRIVE"] = "workspace_drive";
|
|
32
|
+
GoogleService["WORKSPACE_ADMIN"] = "workspace_admin";
|
|
33
|
+
GoogleService["WORKSPACE_APPS_SCRIPT"] = "workspace_apps_script";
|
|
34
|
+
// Google Identity
|
|
35
|
+
GoogleService["GOOGLE_OAUTH"] = "google_oauth";
|
|
36
|
+
})(GoogleService || (GoogleService = {}));
|
|
37
|
+
/**
|
|
38
|
+
* Categories of persistence mechanisms
|
|
39
|
+
*/
|
|
40
|
+
export var PersistenceCategory;
|
|
41
|
+
(function (PersistenceCategory) {
|
|
42
|
+
PersistenceCategory["SERVICE_ACCOUNT_ABUSE"] = "service_account_abuse";
|
|
43
|
+
PersistenceCategory["IAM_POLICY_MODIFICATION"] = "iam_policy_modification";
|
|
44
|
+
PersistenceCategory["OAUTH_APP_CONSENT"] = "oauth_app_consent";
|
|
45
|
+
PersistenceCategory["API_KEYS"] = "api_keys";
|
|
46
|
+
PersistenceCategory["CLOUD_FUNCTION_TRIGGER"] = "cloud_function_trigger";
|
|
47
|
+
PersistenceCategory["APPS_SCRIPT_TRIGGER"] = "apps_script_trigger";
|
|
48
|
+
PersistenceCategory["DELEGATION_ABUSE"] = "delegation_abuse";
|
|
49
|
+
})(PersistenceCategory || (PersistenceCategory = {}));
|
|
50
|
+
/**
|
|
51
|
+
* GCP Persistence Vectors
|
|
52
|
+
*/
|
|
53
|
+
export const GCP_PERSISTENCE_VECTORS = {
|
|
54
|
+
sa_key_creation: {
|
|
55
|
+
name: 'Service Account Key Creation',
|
|
56
|
+
service: GoogleService.GCP_SERVICE_ACCOUNTS,
|
|
57
|
+
category: PersistenceCategory.SERVICE_ACCOUNT_ABUSE,
|
|
58
|
+
description: 'Create keys for service accounts to maintain API access',
|
|
59
|
+
techniqueId: 'T1098.001',
|
|
60
|
+
requiredPermissions: ['iam.serviceAccountKeys.create'],
|
|
61
|
+
detectionMethods: ['Cloud Audit Logs', 'Security Command Center'],
|
|
62
|
+
mitigations: ['Use Workload Identity', 'Key rotation policies'],
|
|
63
|
+
stealthRating: 2,
|
|
64
|
+
},
|
|
65
|
+
iam_binding: {
|
|
66
|
+
name: 'IAM Policy Binding',
|
|
67
|
+
service: GoogleService.GCP_IAM,
|
|
68
|
+
category: PersistenceCategory.IAM_POLICY_MODIFICATION,
|
|
69
|
+
description: 'Add IAM bindings for persistent access',
|
|
70
|
+
techniqueId: 'T1098.001',
|
|
71
|
+
requiredPermissions: ['resourcemanager.projects.setIamPolicy'],
|
|
72
|
+
detectionMethods: ['IAM audit logs', 'Policy monitoring'],
|
|
73
|
+
mitigations: ['IAM Recommender', 'Least privilege'],
|
|
74
|
+
stealthRating: 1,
|
|
75
|
+
},
|
|
76
|
+
cloud_function_backdoor: {
|
|
77
|
+
name: 'Cloud Function Backdoor',
|
|
78
|
+
service: GoogleService.GCP_CLOUD_FUNCTIONS,
|
|
79
|
+
category: PersistenceCategory.CLOUD_FUNCTION_TRIGGER,
|
|
80
|
+
description: 'Deploy function as persistent callback',
|
|
81
|
+
techniqueId: 'T1059',
|
|
82
|
+
requiredPermissions: ['cloudfunctions.functions.create'],
|
|
83
|
+
detectionMethods: ['Function deployment logs', 'Network monitoring'],
|
|
84
|
+
mitigations: ['Function allowlisting', 'Binary authorization'],
|
|
85
|
+
stealthRating: 3,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Workspace Persistence Vectors
|
|
90
|
+
*/
|
|
91
|
+
export const WORKSPACE_PERSISTENCE_VECTORS = {
|
|
92
|
+
oauth_consent: {
|
|
93
|
+
name: 'OAuth App Consent Persistence',
|
|
94
|
+
service: GoogleService.GOOGLE_OAUTH,
|
|
95
|
+
category: PersistenceCategory.OAUTH_APP_CONSENT,
|
|
96
|
+
description: 'Persist via OAuth app with broad scope consent',
|
|
97
|
+
techniqueId: 'T1550.001',
|
|
98
|
+
requiredPermissions: ['OAuth consent grant'],
|
|
99
|
+
detectionMethods: ['OAuth audit logs', 'App access reviews'],
|
|
100
|
+
mitigations: ['OAuth app restrictions', 'Consent monitoring'],
|
|
101
|
+
stealthRating: 4,
|
|
102
|
+
},
|
|
103
|
+
apps_script_trigger: {
|
|
104
|
+
name: 'Apps Script Trigger Persistence',
|
|
105
|
+
service: GoogleService.WORKSPACE_APPS_SCRIPT,
|
|
106
|
+
category: PersistenceCategory.APPS_SCRIPT_TRIGGER,
|
|
107
|
+
description: 'Create time/event triggers in Apps Script',
|
|
108
|
+
techniqueId: 'T1053',
|
|
109
|
+
requiredPermissions: ['Script Editor access'],
|
|
110
|
+
detectionMethods: ['Apps Script audit logs', 'Trigger inventory'],
|
|
111
|
+
mitigations: ['Apps Script restrictions', 'Trigger monitoring'],
|
|
112
|
+
stealthRating: 4,
|
|
113
|
+
},
|
|
114
|
+
drive_sharing: {
|
|
115
|
+
name: 'Drive Sharing Persistence',
|
|
116
|
+
service: GoogleService.WORKSPACE_DRIVE,
|
|
117
|
+
category: PersistenceCategory.DELEGATION_ABUSE,
|
|
118
|
+
description: 'Maintain access via shared drive permissions',
|
|
119
|
+
techniqueId: 'T1213',
|
|
120
|
+
requiredPermissions: ['Drive sharing permissions'],
|
|
121
|
+
detectionMethods: ['Drive audit logs', 'Sharing reports'],
|
|
122
|
+
mitigations: ['External sharing restrictions', 'DLP policies'],
|
|
123
|
+
stealthRating: 3,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Google Persistence Researcher
|
|
128
|
+
*/
|
|
129
|
+
export class GooglePersistenceResearcher {
|
|
130
|
+
constructor(authorization, verbose = false) {
|
|
131
|
+
this.testResults = [];
|
|
132
|
+
this.authorization = authorization;
|
|
133
|
+
this.verbose = verbose;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Check authorization
|
|
137
|
+
*/
|
|
138
|
+
checkAuthorization() {
|
|
139
|
+
if (!this.authorization) {
|
|
140
|
+
throw new Error('No authorization record.');
|
|
141
|
+
}
|
|
142
|
+
const allowed = [
|
|
143
|
+
AuthorizationScope.OWNED_SYSTEMS,
|
|
144
|
+
AuthorizationScope.PENTEST_ENGAGEMENT,
|
|
145
|
+
AuthorizationScope.RED_TEAM,
|
|
146
|
+
AuthorizationScope.BUG_BOUNTY,
|
|
147
|
+
];
|
|
148
|
+
if (!allowed.includes(this.authorization.scope)) {
|
|
149
|
+
throw new Error('Google research requires pentest/red team authorization.');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get all Google persistence vectors
|
|
154
|
+
*/
|
|
155
|
+
getAllVectors() {
|
|
156
|
+
return { ...GCP_PERSISTENCE_VECTORS, ...WORKSPACE_PERSISTENCE_VECTORS };
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get vectors by service
|
|
160
|
+
*/
|
|
161
|
+
getVectorsByService(service) {
|
|
162
|
+
const all = this.getAllVectors();
|
|
163
|
+
return Object.values(all).filter(v => v.service === service);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get vectors by category
|
|
167
|
+
*/
|
|
168
|
+
getVectorsByCategory(category) {
|
|
169
|
+
const all = this.getAllVectors();
|
|
170
|
+
return Object.values(all).filter(v => v.category === category);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get stealthy vectors
|
|
174
|
+
*/
|
|
175
|
+
getStealthyVectors(minRating = 3) {
|
|
176
|
+
const all = this.getAllVectors();
|
|
177
|
+
return Object.values(all).filter(v => v.stealthRating >= minRating);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Analyze a persistence vector
|
|
181
|
+
*/
|
|
182
|
+
analyzeVector(vectorId, targetProject) {
|
|
183
|
+
this.checkAuthorization();
|
|
184
|
+
const allVectors = this.getAllVectors();
|
|
185
|
+
if (!(vectorId in allVectors)) {
|
|
186
|
+
throw new Error(`Unknown vector: ${vectorId}`);
|
|
187
|
+
}
|
|
188
|
+
const vector = allVectors[vectorId];
|
|
189
|
+
if (!vector) {
|
|
190
|
+
throw new Error(`Unknown vector ID: ${vectorId}`);
|
|
191
|
+
}
|
|
192
|
+
const result = {
|
|
193
|
+
vector,
|
|
194
|
+
targetProject,
|
|
195
|
+
timestamp: Date.now(),
|
|
196
|
+
testable: true,
|
|
197
|
+
permissionsVerified: [],
|
|
198
|
+
missingPermissions: [],
|
|
199
|
+
detectionRisk: vector.stealthRating < 3 ? 'medium' : 'low',
|
|
200
|
+
notes: `Analysis for ${vector.name}`,
|
|
201
|
+
};
|
|
202
|
+
if (this.verbose) {
|
|
203
|
+
console.log(`[Google] Analyzing ${vector.name}`);
|
|
204
|
+
console.log(` Service: ${vector.service}`);
|
|
205
|
+
console.log(` Stealth: ${vector.stealthRating}/5`);
|
|
206
|
+
}
|
|
207
|
+
this.testResults.push(result);
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Generate attack playbook
|
|
212
|
+
*/
|
|
213
|
+
generateAttackPlaybook(targetProject, vectors) {
|
|
214
|
+
this.checkAuthorization();
|
|
215
|
+
const useVectors = vectors || Object.values(this.getAllVectors());
|
|
216
|
+
// Sort by stealth rating (stealthiest first)
|
|
217
|
+
const sorted = [...useVectors].sort((a, b) => b.stealthRating - a.stealthRating);
|
|
218
|
+
return {
|
|
219
|
+
target: targetProject,
|
|
220
|
+
generated: new Date().toISOString(),
|
|
221
|
+
authorization: {
|
|
222
|
+
scope: this.authorization.scope,
|
|
223
|
+
authorizedBy: this.authorization.authorizedBy,
|
|
224
|
+
},
|
|
225
|
+
vectors: sorted.map(v => ({
|
|
226
|
+
name: v.name,
|
|
227
|
+
service: v.service,
|
|
228
|
+
category: v.category,
|
|
229
|
+
stealthRating: v.stealthRating,
|
|
230
|
+
requiredPermissions: v.requiredPermissions,
|
|
231
|
+
detectionMethods: v.detectionMethods,
|
|
232
|
+
})),
|
|
233
|
+
recommendedOrder: sorted.map(v => v.name),
|
|
234
|
+
detectionCoverage: Array.from(new Set(sorted.flatMap(v => v.detectionMethods))),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Generate detection report (blue team)
|
|
239
|
+
*/
|
|
240
|
+
generateDetectionReport() {
|
|
241
|
+
this.checkAuthorization();
|
|
242
|
+
const allVectors = this.getAllVectors();
|
|
243
|
+
const lines = [
|
|
244
|
+
'# Google Infrastructure Detection Guide',
|
|
245
|
+
'',
|
|
246
|
+
`Generated: ${new Date().toISOString()}`,
|
|
247
|
+
'',
|
|
248
|
+
'## Overview',
|
|
249
|
+
'',
|
|
250
|
+
`This guide covers ${Object.keys(allVectors).length} persistence vectors.`,
|
|
251
|
+
'',
|
|
252
|
+
'## Detection Methods',
|
|
253
|
+
'',
|
|
254
|
+
];
|
|
255
|
+
// Group by detection method
|
|
256
|
+
const detectionMap = {};
|
|
257
|
+
for (const vector of Object.values(allVectors)) {
|
|
258
|
+
for (const method of vector.detectionMethods) {
|
|
259
|
+
if (!detectionMap[method]) {
|
|
260
|
+
detectionMap[method] = [];
|
|
261
|
+
}
|
|
262
|
+
detectionMap[method].push(vector.name);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const [method, vectorNames] of Object.entries(detectionMap).sort()) {
|
|
266
|
+
lines.push(`### ${method}`);
|
|
267
|
+
lines.push('');
|
|
268
|
+
lines.push('Detects:');
|
|
269
|
+
for (const name of vectorNames) {
|
|
270
|
+
lines.push(`- ${name}`);
|
|
271
|
+
}
|
|
272
|
+
lines.push('');
|
|
273
|
+
}
|
|
274
|
+
lines.push('## Vectors by Stealth Rating');
|
|
275
|
+
lines.push('');
|
|
276
|
+
for (let rating = 5; rating >= 1; rating--) {
|
|
277
|
+
const vectorsAtRating = Object.values(allVectors).filter(v => v.stealthRating === rating);
|
|
278
|
+
if (vectorsAtRating.length > 0) {
|
|
279
|
+
lines.push(`### Stealth ${rating}/5`);
|
|
280
|
+
for (const v of vectorsAtRating) {
|
|
281
|
+
lines.push(`- ${v.name} (${v.service})`);
|
|
282
|
+
}
|
|
283
|
+
lines.push('');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return lines.join('\n');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Create Google authorization
|
|
291
|
+
*/
|
|
292
|
+
export function createGoogleAuthorization(engagementType, authorizedBy, targetProject = '*', scopeNotes = '') {
|
|
293
|
+
const scopeMap = {
|
|
294
|
+
bug_bounty: AuthorizationScope.BUG_BOUNTY,
|
|
295
|
+
pentest: AuthorizationScope.PENTEST_ENGAGEMENT,
|
|
296
|
+
red_team: AuthorizationScope.RED_TEAM,
|
|
297
|
+
owned: AuthorizationScope.OWNED_SYSTEMS,
|
|
298
|
+
};
|
|
299
|
+
return {
|
|
300
|
+
scope: scopeMap[engagementType] || AuthorizationScope.PENTEST_ENGAGEMENT,
|
|
301
|
+
targetDomain: `*.googleapis.com,${targetProject}.iam.gserviceaccount.com`,
|
|
302
|
+
authorizedBy,
|
|
303
|
+
authorizationDate: new Date().toISOString(),
|
|
304
|
+
scopeLimitations: [],
|
|
305
|
+
outOfScope: [],
|
|
306
|
+
notes: scopeNotes || `Google ${engagementType} engagement`,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Security Module Loader
|
|
3
|
+
*
|
|
4
|
+
* Provides lazy loading for the optional Google security research module.
|
|
5
|
+
*
|
|
6
|
+
* Principal Investigator: Bo Shang
|
|
7
|
+
* Framework: erosolar-cli
|
|
8
|
+
*/
|
|
9
|
+
let googleModule = null;
|
|
10
|
+
/**
|
|
11
|
+
* Check if Google security research module is available
|
|
12
|
+
*/
|
|
13
|
+
export function isGoogleEnabled() {
|
|
14
|
+
if (googleModule !== null) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
// Dynamic import check would go here
|
|
19
|
+
// For now, return true since we're creating the module
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the Google security research module (lazy load)
|
|
28
|
+
*/
|
|
29
|
+
export async function getGoogleModule() {
|
|
30
|
+
if (googleModule === null) {
|
|
31
|
+
try {
|
|
32
|
+
googleModule = await import('./google.js');
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new Error('Google security research module not available. ' +
|
|
36
|
+
'Ensure google.ts is built and available.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return googleModule;
|
|
40
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Research Module for Alpha Zero 2
|
|
3
|
+
*
|
|
4
|
+
* OPTIONAL MODULE - Only loaded when security research is enabled.
|
|
5
|
+
*
|
|
6
|
+
* A modular security research framework with optional provider-specific extensions.
|
|
7
|
+
* All capabilities require explicit authorization.
|
|
8
|
+
*
|
|
9
|
+
* LEGAL NOTICE:
|
|
10
|
+
* These tools are intended for:
|
|
11
|
+
* - Authorized penetration testing engagements
|
|
12
|
+
* - Bug bounty programs with explicit scope
|
|
13
|
+
* - CTF competitions and security training
|
|
14
|
+
* - Red team exercises with written authorization
|
|
15
|
+
* - Security research on systems you own or have permission to test
|
|
16
|
+
*
|
|
17
|
+
* Structure:
|
|
18
|
+
* - core: Base authorization and reconnaissance (always available)
|
|
19
|
+
* - simulation: Attack simulation framework (always available)
|
|
20
|
+
* - google: Google Cloud/Workspace persistence research (optional)
|
|
21
|
+
*
|
|
22
|
+
* Principal Investigator: Bo Shang
|
|
23
|
+
* Framework: erosolar-cli
|
|
24
|
+
*/
|
|
25
|
+
// Re-export core security components
|
|
26
|
+
export { AuthorizationScope, SecurityResearchEngine, createBugBountyAuthorization, createPentestAuthorization, createCtfAuthorization, } from './core.js';
|
|
27
|
+
// Re-export simulation components
|
|
28
|
+
export { AttackCategory, AttackPhase, AttackSimulator, PayloadGenerator, ATTACK_VECTORS, } from './simulation.js';
|
|
29
|
+
// Google module is optional - export checker function
|
|
30
|
+
export { isGoogleEnabled, getGoogleModule } from './googleLoader.js';
|
|
31
|
+
export const SECURITY_VERSION = '1.0.0';
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attack Simulation Framework
|
|
3
|
+
*
|
|
4
|
+
* Provides controlled attack simulations for red team exercises.
|
|
5
|
+
* All simulations require explicit authorization.
|
|
6
|
+
*
|
|
7
|
+
* Principal Investigator: Bo Shang
|
|
8
|
+
* Framework: erosolar-cli
|
|
9
|
+
*/
|
|
10
|
+
import { AuthorizationScope } from './core.js';
|
|
11
|
+
/**
|
|
12
|
+
* Categories of attack simulations
|
|
13
|
+
*/
|
|
14
|
+
export var AttackCategory;
|
|
15
|
+
(function (AttackCategory) {
|
|
16
|
+
AttackCategory["RECONNAISSANCE"] = "reconnaissance";
|
|
17
|
+
AttackCategory["WEB_APPLICATION"] = "web_application";
|
|
18
|
+
AttackCategory["AUTHENTICATION"] = "authentication";
|
|
19
|
+
AttackCategory["INJECTION"] = "injection";
|
|
20
|
+
AttackCategory["MISCONFIGURATION"] = "misconfiguration";
|
|
21
|
+
AttackCategory["PRIVILEGE_ESCALATION"] = "privilege_escalation";
|
|
22
|
+
AttackCategory["DATA_EXFILTRATION"] = "data_exfiltration";
|
|
23
|
+
})(AttackCategory || (AttackCategory = {}));
|
|
24
|
+
/**
|
|
25
|
+
* MITRE ATT&CK inspired attack phases
|
|
26
|
+
*/
|
|
27
|
+
export var AttackPhase;
|
|
28
|
+
(function (AttackPhase) {
|
|
29
|
+
AttackPhase["INITIAL_ACCESS"] = "initial_access";
|
|
30
|
+
AttackPhase["EXECUTION"] = "execution";
|
|
31
|
+
AttackPhase["PERSISTENCE"] = "persistence";
|
|
32
|
+
AttackPhase["PRIVILEGE_ESCALATION"] = "privilege_escalation";
|
|
33
|
+
AttackPhase["DEFENSE_EVASION"] = "defense_evasion";
|
|
34
|
+
AttackPhase["CREDENTIAL_ACCESS"] = "credential_access";
|
|
35
|
+
AttackPhase["DISCOVERY"] = "discovery";
|
|
36
|
+
AttackPhase["LATERAL_MOVEMENT"] = "lateral_movement";
|
|
37
|
+
AttackPhase["COLLECTION"] = "collection";
|
|
38
|
+
AttackPhase["EXFILTRATION"] = "exfiltration";
|
|
39
|
+
AttackPhase["IMPACT"] = "impact";
|
|
40
|
+
})(AttackPhase || (AttackPhase = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Common attack vectors based on OWASP Top 10 and MITRE ATT&CK
|
|
43
|
+
*/
|
|
44
|
+
export const ATTACK_VECTORS = {
|
|
45
|
+
sql_injection: {
|
|
46
|
+
name: 'SQL Injection',
|
|
47
|
+
category: AttackCategory.INJECTION,
|
|
48
|
+
phase: AttackPhase.INITIAL_ACCESS,
|
|
49
|
+
description: 'Inject malicious SQL queries',
|
|
50
|
+
techniqueId: 'T1190',
|
|
51
|
+
prerequisites: ['web_application_identified', 'input_field_found'],
|
|
52
|
+
detectionMethods: ['WAF rules', 'Database monitoring'],
|
|
53
|
+
mitigations: ['Parameterized queries', 'Input validation'],
|
|
54
|
+
},
|
|
55
|
+
xss_reflected: {
|
|
56
|
+
name: 'Reflected XSS',
|
|
57
|
+
category: AttackCategory.WEB_APPLICATION,
|
|
58
|
+
phase: AttackPhase.INITIAL_ACCESS,
|
|
59
|
+
description: 'Inject scripts reflected to users',
|
|
60
|
+
techniqueId: 'T1189',
|
|
61
|
+
prerequisites: ['web_application_identified', 'reflection_point_found'],
|
|
62
|
+
detectionMethods: ['CSP reports', 'WAF XSS rules'],
|
|
63
|
+
mitigations: ['CSP', 'Output encoding', 'Input validation'],
|
|
64
|
+
},
|
|
65
|
+
ssrf: {
|
|
66
|
+
name: 'Server-Side Request Forgery',
|
|
67
|
+
category: AttackCategory.WEB_APPLICATION,
|
|
68
|
+
phase: AttackPhase.DISCOVERY,
|
|
69
|
+
description: 'Abuse server to make internal requests',
|
|
70
|
+
techniqueId: 'T1090',
|
|
71
|
+
prerequisites: ['url_parameter_found'],
|
|
72
|
+
detectionMethods: ['Outbound request monitoring'],
|
|
73
|
+
mitigations: ['URL allowlisting', 'Network segmentation'],
|
|
74
|
+
},
|
|
75
|
+
auth_bypass: {
|
|
76
|
+
name: 'Authentication Bypass',
|
|
77
|
+
category: AttackCategory.AUTHENTICATION,
|
|
78
|
+
phase: AttackPhase.INITIAL_ACCESS,
|
|
79
|
+
description: 'Bypass authentication mechanisms',
|
|
80
|
+
techniqueId: 'T1078',
|
|
81
|
+
prerequisites: ['auth_endpoint_identified'],
|
|
82
|
+
detectionMethods: ['Failed login monitoring', 'Session anomalies'],
|
|
83
|
+
mitigations: ['MFA', 'Strong session management'],
|
|
84
|
+
},
|
|
85
|
+
path_traversal: {
|
|
86
|
+
name: 'Path Traversal',
|
|
87
|
+
category: AttackCategory.WEB_APPLICATION,
|
|
88
|
+
phase: AttackPhase.COLLECTION,
|
|
89
|
+
description: 'Access files outside webroot',
|
|
90
|
+
techniqueId: 'T1083',
|
|
91
|
+
prerequisites: ['file_parameter_found'],
|
|
92
|
+
detectionMethods: ['Path pattern monitoring', 'WAF rules'],
|
|
93
|
+
mitigations: ['Input validation', 'Chroot/sandbox'],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Payload generator for security testing
|
|
98
|
+
*/
|
|
99
|
+
export class PayloadGenerator {
|
|
100
|
+
/**
|
|
101
|
+
* Generate SQL injection test payloads
|
|
102
|
+
*/
|
|
103
|
+
static sqlInjectionPayloads() {
|
|
104
|
+
return [
|
|
105
|
+
"' OR '1'='1",
|
|
106
|
+
"'; DROP TABLE users--",
|
|
107
|
+
"1' AND '1'='1",
|
|
108
|
+
"1 UNION SELECT NULL--",
|
|
109
|
+
"admin'--",
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Generate XSS test payloads
|
|
114
|
+
*/
|
|
115
|
+
static xssPayloads() {
|
|
116
|
+
return [
|
|
117
|
+
"<script>alert(1)</script>",
|
|
118
|
+
"<img src=x onerror=alert(1)>",
|
|
119
|
+
"javascript:alert(1)",
|
|
120
|
+
"<svg onload=alert(1)>",
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Generate path traversal test payloads
|
|
125
|
+
*/
|
|
126
|
+
static pathTraversalPayloads() {
|
|
127
|
+
return [
|
|
128
|
+
"../../../etc/passwd",
|
|
129
|
+
"..\\..\\..\\windows\\system32\\config\\sam",
|
|
130
|
+
"....//....//....//etc/passwd",
|
|
131
|
+
"%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd",
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Encode payload
|
|
136
|
+
*/
|
|
137
|
+
static encodePayload(payload, encoding) {
|
|
138
|
+
switch (encoding) {
|
|
139
|
+
case 'base64':
|
|
140
|
+
return Buffer.from(payload).toString('base64');
|
|
141
|
+
case 'url':
|
|
142
|
+
return encodeURIComponent(payload);
|
|
143
|
+
case 'hex':
|
|
144
|
+
return Buffer.from(payload).toString('hex');
|
|
145
|
+
default:
|
|
146
|
+
return payload;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Attack simulator
|
|
152
|
+
*/
|
|
153
|
+
export class AttackSimulator {
|
|
154
|
+
constructor(authorization, verbose = false) {
|
|
155
|
+
this.results = [];
|
|
156
|
+
this.authorization = authorization;
|
|
157
|
+
this.verbose = verbose;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Check authorization
|
|
161
|
+
*/
|
|
162
|
+
checkAuthorization(target) {
|
|
163
|
+
if (!this.authorization) {
|
|
164
|
+
throw new Error('No authorization record.');
|
|
165
|
+
}
|
|
166
|
+
// Attack simulations require stronger authorization
|
|
167
|
+
const allowed = [
|
|
168
|
+
AuthorizationScope.OWNED_SYSTEMS,
|
|
169
|
+
AuthorizationScope.PENTEST_ENGAGEMENT,
|
|
170
|
+
AuthorizationScope.RED_TEAM,
|
|
171
|
+
AuthorizationScope.CTF_COMPETITION,
|
|
172
|
+
];
|
|
173
|
+
if (!allowed.includes(this.authorization.scope)) {
|
|
174
|
+
throw new Error('Simulations require pentest/red team authorization.');
|
|
175
|
+
}
|
|
176
|
+
const inScope = this.authorization.targetDomain.includes(target) ||
|
|
177
|
+
target.endsWith(this.authorization.targetDomain);
|
|
178
|
+
if (!inScope) {
|
|
179
|
+
throw new Error(`Target ${target} not in scope.`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Simulate an attack vector
|
|
184
|
+
*/
|
|
185
|
+
async simulateAttack(target, vectorId, dryRun = true) {
|
|
186
|
+
this.checkAuthorization(target);
|
|
187
|
+
if (!(vectorId in ATTACK_VECTORS)) {
|
|
188
|
+
throw new Error(`Unknown attack vector: ${vectorId}`);
|
|
189
|
+
}
|
|
190
|
+
const vector = ATTACK_VECTORS[vectorId];
|
|
191
|
+
if (!vector) {
|
|
192
|
+
throw new Error(`Unknown attack vector: ${vectorId}`);
|
|
193
|
+
}
|
|
194
|
+
const startTime = Date.now();
|
|
195
|
+
if (this.verbose) {
|
|
196
|
+
console.log(`[Simulation] ${vector.name} against ${target}`);
|
|
197
|
+
console.log(` Technique: ${vector.techniqueId}`);
|
|
198
|
+
console.log(` Dry run: ${dryRun}`);
|
|
199
|
+
}
|
|
200
|
+
const result = {
|
|
201
|
+
vector,
|
|
202
|
+
target,
|
|
203
|
+
timestamp: startTime,
|
|
204
|
+
success: false,
|
|
205
|
+
evidence: [],
|
|
206
|
+
artifacts: {
|
|
207
|
+
payloads: this.getPayloadsForVector(vectorId),
|
|
208
|
+
payloadCount: this.getPayloadsForVector(vectorId).length,
|
|
209
|
+
},
|
|
210
|
+
detectionTriggered: false,
|
|
211
|
+
durationMs: 0,
|
|
212
|
+
notes: `Dry run: ${dryRun}`,
|
|
213
|
+
};
|
|
214
|
+
if (!dryRun) {
|
|
215
|
+
result.notes = 'Live simulation not implemented for safety';
|
|
216
|
+
}
|
|
217
|
+
result.durationMs = Date.now() - startTime;
|
|
218
|
+
this.results.push(result);
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get payloads for a vector
|
|
223
|
+
*/
|
|
224
|
+
getPayloadsForVector(vectorId) {
|
|
225
|
+
if (vectorId.includes('sql')) {
|
|
226
|
+
return PayloadGenerator.sqlInjectionPayloads();
|
|
227
|
+
}
|
|
228
|
+
if (vectorId.includes('xss')) {
|
|
229
|
+
return PayloadGenerator.xssPayloads();
|
|
230
|
+
}
|
|
231
|
+
if (vectorId.includes('path') || vectorId.includes('traversal')) {
|
|
232
|
+
return PayloadGenerator.pathTraversalPayloads();
|
|
233
|
+
}
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Get vectors by category
|
|
238
|
+
*/
|
|
239
|
+
getVectorsByCategory(category) {
|
|
240
|
+
return Object.values(ATTACK_VECTORS).filter(v => v.category === category);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Get vectors by phase
|
|
244
|
+
*/
|
|
245
|
+
getVectorsByPhase(phase) {
|
|
246
|
+
return Object.values(ATTACK_VECTORS).filter(v => v.phase === phase);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Generate report
|
|
250
|
+
*/
|
|
251
|
+
generateReport() {
|
|
252
|
+
const lines = [
|
|
253
|
+
'='.repeat(60),
|
|
254
|
+
'ATTACK SIMULATION REPORT',
|
|
255
|
+
'='.repeat(60),
|
|
256
|
+
`Generated: ${new Date().toISOString()}`,
|
|
257
|
+
`Target: ${this.authorization.targetDomain}`,
|
|
258
|
+
`Scope: ${this.authorization.scope}`,
|
|
259
|
+
`Simulations: ${this.results.length}`,
|
|
260
|
+
'',
|
|
261
|
+
];
|
|
262
|
+
for (let i = 0; i < this.results.length; i++) {
|
|
263
|
+
const result = this.results[i];
|
|
264
|
+
if (!result)
|
|
265
|
+
continue;
|
|
266
|
+
lines.push(`[${i + 1}] ${result.vector.name}`);
|
|
267
|
+
lines.push(` Target: ${result.target}`);
|
|
268
|
+
lines.push(` Success: ${result.success}`);
|
|
269
|
+
lines.push(` Duration: ${result.durationMs}ms`);
|
|
270
|
+
lines.push(` Payloads: ${result.artifacts['payloadCount'] || 0}`);
|
|
271
|
+
}
|
|
272
|
+
return lines.join('\n');
|
|
273
|
+
}
|
|
274
|
+
}
|