AI-First Multi-Agent Operating System with Zenith Coder, Agent Zero, and MCP Integration
BorgOS is an AI-first multi-agent operating system that integrates multiple AI agents (Agent Zero, Zenith Coder) with MCP (Model Context Protocol) to ...
356 async def tool_execute_command(self, command: str, working_dir: Optional[str] = None) -> Dict[str, Any]:
357 """Execute system command"""
358 import subprocess
359
360 try:
361 result = subprocess.run(
362 command,
363 shell=True,
364 cwd=working_dir,
365 capture_output=True,
366 text=True,
367 timeout=30
368 )
369 ...// Network-exposed MCP server allows remote attackers to execute arbitrary commands.
68 "execute_command": {
69 "description": "Execute a system command",
70 "parameters": {
71 "command": {"type": "string", "required": True},
72 "working_dir": {"type": "string", "required": False}
73 },
74 "handler": self.tool_execute_command
75 },// Network-exposed MCP server allows remote attackers to execute arbitrary commands.
138 if request.method == 'POST':
139 query = request.form.get('q', '')
140 if query:
141 try:
142 result = subprocess.run(
143 ['/opt/borgos/env/bin/python3', '/usr/local/bin/borg', query],
144 capture_output=True,
145 text=True,
146 timeout=30
147 )
148 output = result.stdout or result.stderr
149 except subprocess.TimeoutExpired:
150 output = "Command timed out after 30 seconds"
151 except Exception as e:
152 output = f"Error: {str(e)}"// Network-exposed web dashboard allows remote attackers to inject commands.
167 data = request.json
168 query = data.get('query', '')
169
170 if not query:
171 return jsonify({'error': 'No query provided'}), 400
172
173 try:
174 result = subprocess.run(
175 ['borg', query],
176 capture_output=True,
177 text=True,
178 timeout=30
179 )
180 return jsonify({
181 'query': query,
182 'response': result.stdout,
183 'error': result.stderr if result.returncode != 0 else None
184 })// Network-exposed API allows remote attackers to inject commands.
106 async def start_agent(self, config: Optional[Dict[str, Any]] = None) -> bool:
107 ...
108 cmd = [
109 sys.executable,
110 str(self.agent_zero_dir / "run_ui.py"),
111 "--port", str(self.agent_port)
112 ]
113
114 logger.info(f"Starting Agent Zero on port {self.agent_port}...")
115 self.agent_process = subprocess.Popen(
116 cmd,
117 cwd=str(self.agent_zero_dir),
118 stdout=subprocess.PIPE,
119 stderr=subprocess.PIPE
120 )// Network-exposed API allows attackers to trigger agent start/stop, potentially leading to code execution.
117 def setup_middleware(self):
118 self.app.add_middleware(
119 CORSMiddleware,
120 allow_origins=["*"],
121 allow_credentials=True,
122 allow_methods=["*"],
123 allow_headers=["*"],
124 )// Network-exposed API without authentication allows anyone to access all functionality.
558 @app.websocket("/ws")
559 async def websocket_endpoint(websocket: WebSocket):
560 await self.websocket_manager.connect(websocket)
561 try:
562 while True:
563 data = await websocket.receive_text()
564 # Echo back for now
565 await websocket.send_text(f"Echo: {data}")
566 except WebSocketDisconnect:
567 self.websocket_manager.disconnect(websocket)// Network-exposed WebSocket without authentication allows information disclosure.
129 self.db_pool = await asyncpg.create_pool(
130 host=os.getenv("DB_HOST", "postgres"),
131 port=int(os.getenv("DB_PORT", 5432)),
132 database=os.getenv("DB_NAME", "borgos"),
133 user=os.getenv("DB_USER", "borgos"),
134 password=os.getenv("DB_PASSWORD", "borgos123"),
135 min_size=10,
136 max_size=20
137 )// Network-exposed database or environment variable leakage could lead to credential exposure.
60 def create_default_env(self):
61 """Create default .env file for Agent Zero"""
62 env_content = """
63# Agent Zero Configuration for BorgOS
64
65# API Keys (will be managed by BorgOS)
66OPENAI_API_KEY=
67ANTHROPIC_API_KEY=
68GROQ_API_KEY=
69OPENROUTER_API_KEY=
70GOOGLE_API_KEY=
71...// Local file exposure could leak API keys if the .env file is readable.
27const OLLAMA_HOST = process.env.OLLAMA_HOST || 'http://localhost:11434';// Requires control over environment variables, which is unlikely in normal deployment but possible if the attacker has local access.