T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- docker-compose.yml:3
- Finding
- Unauthenticated Redis Exposure Enables Forged Market Data and Unauthorized Trade Influence<![CDATA[ ## Vulnerability Details **File Location**: `docker-compose.yml:3-6`; related trust boundary at `main.py:50-89` **Vulnerability Type**: Unauthenticated service exposure and trusted-message injection **Risk Level**: High ### Vulnerable Code ```yaml redis: image: redis:alpine ports: - "6379:6379" ``` Redis messages are consumed without producer authentication or data-origin verification: ```python # Subscribe to the data feed channel channel = f"tick_{self.symbol.replace('/', '')}" await self.pub_sub.subscribe(channel) async for message in self.pub_sub.listen(): if not self.running: break if message['type'] == 'message': try: # 1. Parse Tick data = json.loads(message['data']) # 2. Update Features self.feature_engine.update(data) ob_snapshot = { 'bid': data['bid'], 'ask': data['ask'], 'bid_vol': data['bid_vol'], 'ask_vol': data['ask_vol'] } features = self.feature_engine.get_features(ob_snapshot) if len(self.feature_engine.prices) < self.feature_engine.window_size: continue signal_strength = self.agent.predict(features) if abs(signal_strength) > 0.5: await self.exec_engine.execute_signal( signal=signal_strength, price=data['last_price'] ) ``` ### Technical Analysis Docker publishes Redis port 6379 on the host without configuring authentication, ACLs, or transport encryption. Unless restricted by an external firewall, Docker's port publication makes the service reachable through host network interfaces. The strategy process treats messages received from the Redis channel as authentic exchange market data. It performs no producer authentication, message signing, freshness enforcement, schema constraints, numeric range validation, or comparison against an independent exchange p ...[truncated 1503 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the host port publication if Redis is only used between containers: ```yaml redis: image: redis:alpine expose: - "6379" ``` 2. Place Redis and application containers on a dedicated internal Docker network. 3. Configure Redis ACLs with separate, least-privileged users for publishers, consumers, and the dashboard. 4. Use TLS for any Redis connection that crosses a host or network trust boundary. 5. Require authenticated or cryptographically signed market-data messages. 6. Validate every tick with a strict schema: - Require finite numeric values. - Reject negative prices or volumes. - Require `bid <= ask`. - Enforce timestamp freshness and monotonicity. - Bound price deviation against a direct exchange data source. 7. Do not permit Redis-originated prices to flow directly into order placement without an independent exchange-price sanity check. 8. Add rate limiting, duplicate detection, and circuit breakers for abnormal message frequency. ]]>
