Sensitive Data in Query String
- CWE 598
Sensitive Data in Query String occurs when an application passes confidential information, such as passwords, session tokens, API keys, or personal data, within URL query parameters. Query strings are often logged by web servers, browser history, network devices, and analytics tools, potentially exposing sensitive information to unintended parties. This vulnerability is commonly found in GET requests where input values are appended to URLs instead of using secure POST methods or encrypted channels.
Common patterns leading to sensitive data exposure:
- Including passwords, authentication tokens, or API keys in URLs for login or API endpoints.
- Passing personally identifiable information (PII) such as Social Security numbers, email addresses, or payment data in query strings.
- Using GET methods for forms or actions that handle confidential data.
- Failure to enforce HTTPS, allowing query strings to be intercepted in transit.
- Lack of proper logging configuration, causing sensitive query strings to appear in server or proxy logs.
Impacts:
- Information Exposure: Sensitive credentials or personal data can be captured by attackers from logs, browser history, or network monitoring.
- Session Hijacking: Exposure of session tokens in URLs can allow attackers to impersonate users.
- Regulatory Non-Compliance: Leakage of PII may violate GDPR, PCI DSS, or other data protection laws.
- Phishing and Social Engineering: Exposed query strings can be used to craft targeted attacks against users.
Detection indicators:
- URLs containing sensitive values (
?password=,?token=,?ssn=) in GET requests. - Logs or browser history capturing confidential parameters.
- Repeated use of query strings for login or sensitive transactions.
Remediation
Preventing sensitive data exposure in query strings requires secure handling of input and transmission:
Use POST Instead of GET for Sensitive Data
Transmit confidential information in the request body rather than the URL to prevent logging in server and browser histories.Encrypt Sensitive Data in Transit
Always use HTTPS/TLS to encrypt requests and responses.Avoid Including Secrets in URLs
Do not pass passwords, tokens, API keys, or PII in query parameters. Use secure headers or session storage instead.Short-Lived Tokens
If tokens must be transmitted in URLs (rare), ensure they expire quickly and are single-use.Secure Logging Practices
Configure server, proxy, and analytics logs to avoid recording sensitive query strings.Input Validation and Encoding
Sanitize user inputs and encode values appropriately to prevent injection or manipulation.User Education and Awareness
Inform users not to share URLs containing sensitive information.Security Testing
Include automated scans and penetration testing to detect sensitive data in query strings.
References
Search Vulnerability
You may also see
- Long Redirect Response
- Error Message
- Stack Trace
- Internal Path
- Not Secure Cookie
- Not Http-Only Cookie
- Sensitive Data in Query String
- Sensitive Data over HTTP
- Server Error
- Source Code Disclosure
- Information Leakage
- Web Backdoor
- Database Connection String
- Autocomplete Enabled
- Undefined Content-Type Header
- Missing X-Frame-Options Header
- File Upload Input Detected
- Mixed Content
- Insecure iFrame
- XPath Injection
- Basic Authentication over HTTP
- Forbidden Resource
- Multiple Choices Enabled
- Apache MultiViews Enabled
- GraphQL Endpoint Detected