T09 · Insecure Skill Coding Practices
- Location
scripts/call_rds_mysql.py:70- Finding
Unrestricted API Endpoint Override Can Redirect Authenticated SDK Requests
- Content
View full analysis
Vulnerability Details
File Location:
scripts/call_rds_mysql.py:70-71, 440, 476
Vulnerability Type: Unrestricted authenticated API endpoint override
Risk Level: MediumComplete Code Snippet:
python if self.endpoint: configuration.host = self.endpointpython parser.add_argument("--endpoint", dest="endpoint", help="API 端点(可选)")python client = RDSMySQLClient(region=args.region, endpoint=args.endpoint)Technical Analysis
The command-line
--endpointvalue is assigned directly to the RDS SDK'sconfiguration.hostwithout validating its scheme, hostname, resolved address, or destination network. The same client configuration contains the Volcengine access key and secret key used to sign API requests.Consequently, anyone able to influence script arguments can redirect signed RDS API requests to an attacker-selected server or an unintended internal service. Depending on the SDK's transport and redirect behavior, the selected endpoint may receive the access-key identifier, signed authorization headers, timestamps, request parameters, and other authentication metadata. The code does not directly print or transmit the secret key in plaintext, so direct disclosure of the raw secret key is not established.
The endpoint override applies to the RDS client. The separately constructed VPC client does not use this custom endpoint.
Attack Path
- The attacker supplies, or causes an agent to supply, a malicious
--endpointargument when invoking the script. - The script reads
VOLCENGINE_ACCESS_KEYandVOLCENGINE_SECRET_KEYfrom its environment. - It places those credentials into the SDK configuration.
- It assigns the untrusted endpoint to
configuration.host. - The user or agent selects an RDS action, such as
list-instances. - The SDK signs the request using the configured credentials and sends it to the attacker-selected destination.
- The destina ...[truncated 1068 chars]
- The attacker supplies, or causes an agent to supply, a malicious
- Remediation
View remediation
Remediation Suggestions
- Remove the public
--endpointoption from production builds unless custom endpoints are an explicit operational requirement. - If custom endpoints are necessary, permit only an explicit allowlist of official Volcengine API hostnames.
- Require HTTPS and reject URLs containing user information, fragments, unexpected ports, or ambiguous host syntax.
- Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and unspecified IP ranges for both IPv4 and IPv6.
- Revalidate every redirect destination or disable redirects for authenticated API calls.
- Ensure hostname validation and TLS certificate verification remain enabled.
- Separate development endpoint overrides from production execution through configuration policy rather than caller-controlled arguments.
- Use narrowly scoped cloud credentials and rotate them if signed requests may have reached an untrusted endpoint.
- Add automated tests covering malicious endpoints, IP literals, DNS rebinding scenarios, redirects, and non-HTTPS schemes.
- Remove the public
