T09 · Insecure Skill Coding Practices
- Location
scripts/monitor.py:16- Finding
User-Controlled Marketplace Enables Arbitrary HTTPS Requests
- Content
View full analysis
2 else "com" pages = int(sys.argv[3]) if len(sys.argv) > 3 else 3 result = monitor_asin(asin, marketplace, pages) ``` ### Technical Analysis The user-controlled `marketplace` argument is interpolated directly into the URL authority without validation: ```python f"https://www.amazon.{marketplace}/..." ``` URL authorities can contain user-information followed by an `@` delimiter. For example, a marketplace argument such as: ```text com@attacker.example ``` produces: ```text https://www.amazon.com@attacker.example/product-reviews/... ``` Under standard URL parsing rules, `www.amazon.com` is interpreted as user-information and `attacker.example` becomes the effective destination hostname. `urllib.request.urlopen()` therefore connects to the attacker-selected host rather than Amazon. The request is restricted to HTTPS by the fixed scheme, and TLS certificate validation limits which destinations can successfully respond. However, this does not prevent connections to attacker-controlled HTTPS servers or other r ...[truncated 1786 chars]- Remediation
View remediation
