T09 · Insecure Skill Coding Practices
- Location
src/baidu_search/main.py:57- Finding
Unauthenticated Search Proxy Binds to All Network Interfaces
- Content
View full analysis
SearchResponse: """ 搜索网页 - **query**: 搜索关键词 - **top_k**: 返回结果数量 (1-20, 默认 10) - **recency_filter**: 时间过滤 (day, week, month, year) - **site_filter**: 限定搜索的网站列表 """ return search(request) ``` ### Technical Analysis When the module is started directly, Uvicorn listens on `0.0.0.0`, making the API reachable through every network interface permitted by the host firewall. This behavior differs from the loopback-only startup commands documented in `SKILL.md`. The `/search` route does not require a token, session, client certificate, or other authorization mechanism. Every accepted request is forwarded to Baidu using the server operator's `BAIDU_API_KEY`. Consequently, any network client that can reach port 8001 can consume the privileged third-party API integration. Request validation limits `top_k` but does not prevent repeated requests, and the application implements no rate limiting or usage quotas. ### Attack Path 1. An operator starts the application directly with `python -m baidu_search.main` or otherwise executes its `__main__` block. 2. Uvicorn binds port 8001 to every available network interface. 3. An attacker discovers the reachable service through network scanning or prior knowledge. 4. The attacker repeatedly sends valid `POST /search` requests without credentials. 5. The server attaches its private Baidu API key to each upstream request. 6. The attacker consumes the operator's API quota and can ...[truncated 631 chars]- Remediation
View remediation
