Summary
The Mercado Pago Node.js SDK inserts caller-controlled identifiers into API request paths without percent-encoding them. If an application passes an attacker-influenced identifier without verifying resource ownership, path normalization or injected query parameters may redirect requests to other resources while carrying the merchant's access token.
Affected context
The issue occurs in SDK clients that construct payment, refund, advanced payment, and disbursement refund endpoint paths from caller-supplied identifiers. It becomes risky when an application forwards identifiers influenced by an untrusted party and relies on the SDK or remote API to enforce ownership, rather than validating that the requested resource belongs to the caller.
Exploit preconditions
- Attack surface: Mercado Pago SDK methods that interpolate identifiers into API request paths
- Required access: Ability to influence an identifier supplied to an affected client method
- Trigger point: Construction and dispatch of the outgoing HTTP request
- Why exploitation is possible: Unencoded path separators, dot-dot segments, or query delimiters can be interpreted structurally by URL parsing and request routing, while the merchant's authentication token remains attached
Why this happens
The SDK builds request URLs by directly interpolating caller-supplied identifiers into template literals. Because the identifier is not percent-encoded as a path component, characters with URL-specific meaning can alter path resolution or introduce query parameters. This is a path traversal and URL construction flaw mapped to CWE-22, where attacker-controlled path input can cause access outside the intended resource location.
Potential impact
- An attacker may access or modify other resources permitted by the merchant's token
- Requests may be redirected to unintended API endpoints
- Attacker-controlled query parameters could alter request behavior
- Sensitive response data may be disclosed
- Payment, refund, or disbursement operations could be performed against unintended resources
General mitigation guidance
Mitigation generally focuses on treating identifiers as data rather than URL syntax.
Common defensive patterns include:
- Percent-encoding every caller-controlled value before placing it in a path segment
- Reusing a centralized path-parameter encoding helper consistently across all clients
- Validating identifier format and rejecting unexpected path or query delimiters
- Enforcing resource ownership and authorization checks before invoking SDK methods
- Avoiding propagation of untrusted identifiers into privileged API clients
- Restricting access-token permissions and applying least privilege where supported
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules for string interpolation of external data into URL paths
- Code review checks for path construction that lacks component encoding
- Searches for SDK methods that concatenate identifiers into endpoint templates
- Tests covering encoded separators, dot segments, and query delimiters
- Policy enforcement requiring centralized URL-building helpers for authenticated API clients
- Automated security review tools that flag untrusted data reaching HTTP request destinations

