What is PunnyCode
Punycode is a way to represent Internationalized Domain Names (IDNs) in the ASCII character set used by the Domain Name System (DNS). It is designed to encode Unicode characters (such as letters with accents or characters from non-Latin scripts) into a format that DNS can process, as DNS can only handle ASCII characters (A-Z, 0-9, and hyphens).
Testing
Testing for vulnerabilities related to Punycode handling involves verifying how an application processes and interprets domain names, specifically in the context of potential phishing attacks, authentication bypasses, or data leakage. Below is an approach a security researcher could take:
It seems like you're consolidating key notes on testing Punycode handling in applications. Here's your content formatted with minor corrections and clarifications to maintain structure and flow:
1. Input Validation Testing
- Test various forms of input to the application:
- Punycode domains (e.g.,
xn--exmple-5za.com
). - Unicode domains (e.g.,
еxample.com
).
- Punycode domains (e.g.,
- Check how the application processes these inputs in fields such as:
- Login forms.
- Email fields.
- URL redirects or open-redirect endpoints.
Expected Observations
- Does the application normalize the input?
- Does it store Punycode (
xn--
) or decode it into Unicode?
2. Application Behavior
Authentication Bypass Testing
- Test if the application treats
xn--exmple-5za.com
as equivalent toexample.com
. - Check how cookies and session tokens are assigned for domains.
Email Sending and Validation
- Submit a Punycode email (e.g.,
user@xn--example-5za.com
). - Verify if emails are sent to the expected Unicode or Punycode address.
URL Handling
- Input URLs with Punycode into link fields or redirects.
- Check how the application rewrites or redirects the URL.
- Does it redirect to the expected domain, or is there a discrepancy?
3. Output Validation Testing
- Monitor how the application outputs Punycode and Unicode:
- In HTTP responses.
- On web pages or logs.
- In APIs (e.g., JSON or XML).
Tools
- Use intercepting proxies (e.g., Burp Suite) to inspect raw requests and responses.
- Inspect Content-Security-Policy (CSP) headers to see how domains are referenced.
4. Browser Rendering
- Submit inputs to the application and inspect how browsers render domains:
- Does the browser show the Unicode version (e.g.,
еxample.com
) or Punycode (e.g.,xn--exmple-5za.com
)?
- Does the browser show the Unicode version (e.g.,
- Note that modern browsers often have safeguards, but some edge cases may exist.