Agent Config - splunk/ShellSweep GitHub Wiki
Agent Configuration (agent_config.yaml)
The agent_config.yaml
file is a crucial component of the ShellSweepX system, providing configuration details for remote agents. This YAML file defines scanning parameters, file types to analyze, and specific rules for entropy-based detection.
File Structure and Purpose
-
directory_paths:
- Lists directories to be scanned by the agents.
- Focuses on critical areas like Exchange Server and IIS web roots.
-
exclude_paths:
- Specifies directories to be excluded from scanning.
- Helps avoid false positives and unnecessary processing.
-
file_extensions:
- Defines file types to be analyzed.
- Each file type has associated entropy thresholds for detection.
-
ignore_hashes:
- Lists SHA256 hashes of files to be ignored during scans.
- Useful for whitelisting known good files.
Entropy-Based Detection
The file_extensions
section uses entropy thresholds for initial webshell detection:
operation: gt
(greater than) orlt
(less than)value
: The entropy threshold
For example, for .php
files:
.php:
operation: gt
value: 4.23015141285636
This means a PHP file with entropy greater than 4.23 is flagged for further analysis.
Technical Details
-
YAML Format:
- Uses YAML for human-readability and easy parsing.
- Allows for structured data representation.
-
Delivery Mechanism:
- The configuration is served via the
/api/agent_config
endpoint in the main application. - Agents periodically fetch this configuration to update their scanning parameters.
- The configuration is served via the
-
Dynamic Updates:
- The configuration can be updated through the Settings page in the web interface.
- Changes are immediately reflected in the API response, allowing for real-time agent configuration updates.
-
Parsing in Agents:
- Agents use YAML parsing libraries (e.g., PyYAML for Python agents) to read this configuration.
- The parsed data structures guide the scanning and analysis process on the agent side.
-
Flexibility:
- The YAML structure allows for easy addition of new parameters or rules.
- Administrators can fine-tune the scanning process without modifying agent code.
-
Security Considerations:
- The configuration should be transmitted securely (e.g., over HTTPS).
- Access to the configuration endpoint should be restricted to authenticated agents.
-
Version Control:
- It's recommended to version control this file to track changes over time.
- Consider implementing a version field in the YAML for compatibility checks.
-
Performance Impact:
- The
exclude_paths
helps optimize performance by avoiding unnecessary scans. - Entropy thresholds allow for quick initial filtering before more intensive analysis.
- The
Usage in the ShellSweepX System
-
Agent Initialization:
- Agents fetch this configuration upon startup.
- Regular updates ensure agents always use the latest scanning parameters.
-
Scan Process:
- Agents use
directory_paths
andexclude_paths
to determine scan targets. - File extensions and entropy thresholds guide the initial detection process.
ignore_hashes
are checked to skip known safe files.
- Agents use
-
Reporting:
- Agents use this configuration to determine which files to report back to the central server for further analysis.
By centralizing this configuration, ShellSweepX ensures consistent behavior across all deployed agents while allowing for flexible and dynamic updates to the scanning process.