PudiHaripriya/soc-env-analyst
OpenEnv: Enterprise SOC Analyst (Procedural Threat Triage)
๐ง Overview
This project introduces a high-fidelity Security Operations Center (SOC) simulation environment designed for evaluating and training autonomous agents in realistic cybersecurity workflows.
Unlike toy environments, this system models:
- Multi-step incident response pipelines
- Procedural reasoning under constraints
- Noisy, adversarial log analysis
- Strict compliance-driven decision making
The agent operates as a Tier-1 SOC Analyst, tasked with:
- Detecting threats from raw SIEM logs
- Investigating using limited tools
- Classifying attacks via MITRE ATT&CK
- Executing mitigation under strict SOP constraints
๐ฏ Why This Environment Matters
Real-world SOC operations are:
- High-risk (incorrect actions can break production systems)
- Procedural (strict runbooks must be followed)
- Noisy (signals buried in irrelevant logs)
- Resource-constrained (limited investigation bandwidth)
This environment captures all of the above, making it a meaningful benchmark for agentic reasoning, not just pattern recognition.
๐๏ธ Repository Structure
.
โโโ models.py # Custom SOC Pydantic models (Actions/Observations)
โโโ client.py # SOC-specific persistent WebSocket client
โโโ openenv.yaml # Official environment specification
โโโ pyproject.toml # Project metadata & UV dependencies
โโโ uv.lock # Deterministic dependency lock
โโโ inference.py # Baseline agent for local evaluation
โโโ __init__.py # Root exports
โโโ README.md # Documentation & HF Metadata
โโโ server/
โโโ __init__.py # Exports MyEnvironment
โโโ app.py # FastAPI server (Official OpenEnv entry)
โโโ Dockerfile # UV-based container definition for HF Spaces
โโโ soc_graders.py # Procedural reward & SOP validation logic
โโโ my_env_environment.py # Core SOC simulation engine logicโ๏ธ Core Environment Design
๐ Observation Space (SOCObservation)
logs: Procedurally generated SIEM logs (multi-format, noisy)tool_results: Threat intelligence responsesremaining_steps: Time constraintapi_budget_remaining: Limited investigation budgetsystem_message: Dynamic feedback + memory
๐ฎ Action Space (SOCAction)
QUERY_INTELโ Investigate IP reputationCREATE_TICKETโ Initiate mitigation workflowBLOCKโ Block external threatISOLATE_INTERNAL_HOSTโ Contain internal compromiseIGNOREโ Dismiss benign activity
๐ฅ Key Features
1. Infinite Procedural Generation
- Every episode generates:
- new IPs
- new attack patterns
- new noise distribution ๐ Prevents memorization, enforces reasoning
2. Strict SOP Enforcement
- Mandatory workflow:
QUERY_INTEL โ CREATE_TICKET โ MITIGATE- Violations โ penalties ๐ Mirrors real SOC runbooks
3. MITRE ATT&CK Integration
Agents must classify attacks using:
- Credential Access
- Exfiltration
- Impact
- Initial Access
- Discovery
4. Resource Constraints
- Limited API calls (
QUERY_INTEL) - Forces strategic decision-making
5. Zero-Day Mechanic
- 30% chance threat intel is WRONG ๐ Agent must trust logs over tools
6. Chaos Mode (Multi-Threat)
- Multiple simultaneous attacks
- Requires prioritization and sequential mitigation
7. Anti-Reward Hacking
- Duplicate actions penalized
- Invalid sequences blocked
8. Dynamic Feedback System
System message tracks:
- Active tickets
- Investigated IPs
- Mitigations
- Remaining threats
๐ Enables memory-based reasoning
๐งช Tasks & Difficulty Scaling
๐ Difficulty increases via noise, ambiguity, and multi-step reasoning
๐ Reward Design
- Positive rewards for:
- correct investigation
- correct classification
- correct mitigation
- Strict Zero-Reward Terminations (Game Over) for:
- Fatal SOP violations (e.g., blocking internal IPs)
- Redundant actions (duplicate tickets)
- Ignoring active zero-day threats ๐ Ensures agents cannot "reward hack" by spamming actions.
๐ Enables dense + meaningful learning signals
๐ค Baseline Agent
The baseline agent:
- Uses an LLM (Qwen / OpenAI-compatible)
- Operates under:
- strict JSON schema
- deterministic inference (
temperature=0,seed=42)
Output Format
[START]
[STEP]
[END]โ Fully OpenEnv compliant โ Reproducible results
โถ๏ธ Running the Environment
1. Install dependencies
# Using UV (Recommended for OpenEnv)
uv sync
source .venv/bin/activate
# OR using pip
pip install -e .2. Set API key
export HF_TOKEN="your_token_here"3. Run inference
export SOC_TASK="hard"
python inference.py๐ Deployment (Hugging Face Spaces)
- Create a Docker Space
- Upload all files
- Wait until status = Running
Validate:
curl -fsSL https://raw.githubusercontent.com/neo-derek/open-env/main/scripts/validate-submission.sh | bash -s -- <your-space-url> .๐ง Design Philosophy: Prompt-Driven SOP vs. Autonomous Exploration
The Critique
The strict SOP workflow may appear partially enforced through the system prompt, raising concerns about reduced reliance on pure environment-driven learning.
Our Perspective
In real-world SOC environments:
- Agents cannot freely explore actions
- Mistakes can cause production failures
- Analysts follow strict procedural runbooks
Thus, the prompt represents operational prior knowledge, not shortcuts.
Environment Guarantees
- Grader enforces SOP rules
- Invalid actions are penalized
- Correct sequencing is validated programmatically
๐ Environment correctness does not depend on prompt compliance
Future Direction
- Introduce
QUERY_SOP - Enable learning via interaction and feedback ๐ Move toward fully autonomous agent learning
๐ Summary
โ Realistic SOC simulation โ Strong OpenEnv compliance โ Multi-step reasoning challenges โ Deterministic evaluation โ Robust reward design
๐ก Final Thought
This is not just an environment โ it is a decision-making benchmark under real-world constraints.
