Testing URL Encoding and Unicode Normalization During an Authorized Web Security Assessment
The author tested how a web application handled different URL encodings and Unicode representations of a query parameter. No vulnerability was demonstrated; the observed differences were due to dynamic content, not a security-control bypass.
Testing URL Encoding and Unicode Normalization During an Authorized Web Security Assessment
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up describes an authorised web security assessment against a production web application. The target domain, IP address and identifying infrastructure details have been removed for privacy and responsible disclosure, so the application itself, its product and the specific feature behind the tested parameter are not described.
The feature under test is the handling of a query parameter named test. The assessment looked at how the application and the layers in front of it parse, decode and canonicalise different representations of the same or similar URL input. The stated goal was not to exploit the application or reach unauthorised information, but to understand whether different layers of the stack interpreted encoded input consistently. Inconsistencies between a CDN, WAF, web server and application can sometimes create security issues, which is why this behaviour is worth observing.
Setup
No accounts, roles or application-specific preconditions are described. The testing was performed from an Android/Termux environment using standard command-line tools, primarily:
curldiffcmpgrepddwc
The author notes that this demonstrated meaningful web-security testing can be performed from a mobile environment when the testing is appropriately scoped.
Finding it
The starting point was a harmless query parameter carrying a plain ASCII value:
?test=TEST123
Several alternative representations of the same or similar input were then sent:
?test=%2F
?test=%252F
?test=%54%45%53%54%31%32%33
?test=%EF%BC%B4%EF%BC%A5%EF%BC%B3%EF%BC%B4
The last one is a full-width Unicode representation. These tests were designed to observe URL parsing and canonicalisation behaviour without attempting to access protected resources.
The sanitised results were recorded as follows:
| Test | Result | Observation |
|---|---|---|
| Normal ASCII input | 200 / 301 | Response behaviour varied between requests |
| URL-encoded "/" | 301 | Application redirected while preserving the encoded representation |
| Double URL encoding | 200 | Application returned the page without the observed redirect |
| Hex-encoded "TEST123" | 301 | Application canonicalised the value to "TEST123" |
| Full-width Unicode "TEST" | 200 | Application returned the page without the observed canonicalisation redirect |
The hexadecimal test was the clearest. The request contained:
%54%45%53%54%31%32%33
The application returned a redirect whose destination contained:
TEST123
That indicates the application was decoding the percent-encoded characters before applying its canonicalisation logic.
The Unicode representation behaved differently from the ASCII representation: it returned an HTTP 200 response instead of the observed 301. At first this looked potentially interesting, because different normalisation paths can sometimes result in security-control inconsistencies.
Exploitation
No exploitation was demonstrated. The steps below are the investigation that followed the observation, and each one ended in a negative result.
Step 1: Send the encoded variants
The four payloads listed above were sent as the value of the test parameter. The hex-encoded form %54%45%53%54%31%32%33 decodes to TEST123, and the redirect destination contained TEST123, showing that decoding happened before canonicalisation. The full-width Unicode form %EF%BC%B4%EF%BC%A5%EF%BC%B3%EF%BC%B4 returned 200 rather than the 301 seen for ASCII input.
Step 2: Download both responses
Because the Unicode request returned 200 instead of 301, both responses were downloaded and compared. Both responses were:
182,597 bytes
However, the files were not byte-for-byte identical.
Step 3: Locate the differences
Rather than assuming the difference represented a security issue, the exact locations where the files differed were investigated. The differences occurred around dynamically generated identifiers associated with the site's translation widget. After examining the surrounding HTML, the differences were determined to be dynamic content rather than evidence that the Unicode input was being interpreted as executable or security-sensitive content.
Step 4: Classify the result
Based on the testing performed, the following were not demonstrated:
- Authentication bypass
- Authorization bypass
- Access to restricted resources
- Sensitive information disclosure
- Code execution
- A confirmed WAF bypass
- A confirmed URL-normalisation vulnerability
The result was therefore classified as Informational / Low rather than a confirmed vulnerability.
Root cause
The report does not identify a code or design defect. What the testing showed is a difference in canonicalisation behaviour: the application decoded percent-encoded characters before applying its canonicalisation logic, as the hex-encoded test demonstrated, and the full-width Unicode input took a different path that returned 200 instead of 301. The byte-level difference between the two response bodies was traced to dynamically generated identifiers in the site's translation widget, not to the input being treated as executable or security-sensitive content.
Why the layers behaved differently is not established in the report. The general concern is that if one layer decodes an input once while another decodes it twice, the components may end up evaluating different representations of the same request. For example:
can become:
while:
%252F
can become:
after one decoding operation and potentially:
after a second. That difference can become security-relevant when the value controls routing, file access, authorisation, redirects or security filtering. In this assessment, no such security-relevant effect was shown.
Impact
No security impact was demonstrated. The report explicitly states that authentication bypass, authorisation bypass, access to restricted resources, sensitive information disclosure, code execution, a confirmed WAF bypass and a confirmed URL-normalisation vulnerability were all absent from the evidence. The observed differences in URL canonicalisation behaviour did not amount to an exploitable security issue, and the result was classified as Informational / Low.
The report makes no claim of vulnerability against the redacted organisation based on the testing described.
Fix
No fix is described, because no vulnerability was confirmed. The report does not state that anything was changed.
Variants to test
These are general directions suggested by the behaviour observed, not findings from this assessment.
- Hex-encoded values in parameters that drive redirects. Send a percent-encoded value such as
%54%45%53%54%31%32%33and check whether the redirect destination contains the decoded form. A positive result is a redirect whose destination contains the decoded value, showing decoding happens before canonicalisation. - Single versus double encoding of path separators. Compare
%2Fand%252Fin the same position. A positive result is the two forms reaching different routing, file access or authorisation decisions, for example one being treated as a path separator by one layer and as literal text by another. - Full-width and other Unicode representations. Send a full-width form such as
%EF%BC%B4%EF%BC%A5%EF%BC%B3%EF%BC%B4alongside the ASCII equivalent and compare status codes and bodies. A positive result is a security-control decision that differs between the two, not merely a different status code. - Byte-level comparison of responses. When two responses differ in status or size, download both and compare them with
cmpanddiff, then inspect the differing regions. A positive result is a difference in security-relevant content rather than dynamic identifiers or other generated markup. - Values that control security decisions. Repeat the encoding variants on parameters that influence routing, file access, authorisation or filtering. A positive result is a demonstrated change in access or filtering outcome, which is what would turn a canonicalisation difference into a vulnerability.
What happened, in plain words
A security researcher was allowed to test a real website to see how it handles different ways of writing the same thing in a web address. They focused on a harmless part of the address called a query parameter, which is the bit after a question mark that usually carries information like a search term. They tried writing the same value in several encoded forms: normal letters, a slash written as %2F, a double-encoded slash, a hex-encoded version of TEST123, and a full-width Unicode version of TEST. Some of these made the site redirect (HTTP 301) and some returned the page normally (HTTP 200). At first the difference looked interesting, but when the researcher downloaded both responses and compared them byte by byte, the only differences were in dynamically generated identifiers from a translation widget. No security problem was found, and the result was classified as Informational / Low. This article explains every step for someone who has never done security testing before.
Introduction
This is a story about a careful test, not about a break-in. The researcher had permission to test a production web application, meaning a real website that people use. The goal was not to steal data or break anything, but to understand whether different parts of the website's infrastructure interpret encoded input in the same way.
A web application is a program that runs on a server and responds to requests from your browser. When you type an address or click a link, your browser sends an HTTP request to a server, and the server sends back an HTTP response. The response includes a status code, which is a number that tells the browser what happened. Two common codes are 200 (OK, here is the page) and 301 (Moved Permanently, the page is somewhere else, go there instead).
A query parameter is the part of a URL after a question mark. For example, in https://example.com/search?q=cat, the parameter is q and its value is cat. Websites use query parameters to pass information such as search terms, page numbers, or tracking codes.
Encoding is a way of writing characters that might otherwise be confusing or unsafe in a URL. For example, a space is often written as %20, and a slash / can be written as %2F. This is called percent-encoding or URL encoding. Each % is followed by two hexadecimal digits (0-9 and A-F) that represent a byte. For instance, %54 is the hexadecimal code for the letter T.
Unicode is a standard for representing characters from all languages. Some characters have full-width forms, which are wider versions often used in East Asian typography. For example, the full-width letter T looks like a wider T. In UTF-8 encoding, T is represented by the bytes EF BC B4, which in percent-encoding becomes %EF%BC%B4.
Canonicalisation (or normalization) is the process of converting different representations of the same value into a single standard form. For example, a web server might decode %54%45%53%54%31%32%33 into TEST123 before deciding what to do with it. Different layers in the stack (CDN, WAF, web server, application) might canonicalise at different times or in different ways, and that can sometimes create security issues.
A CDN (Content Delivery Network) is a network of servers that cache and deliver content close to users. A WAF (Web Application Firewall) is a security filter that inspects HTTP requests and blocks malicious ones. A web server is software like Apache or Nginx that serves files and forwards requests to the application. The application is the code that implements the website's logic.
The researcher removed the target domain, IP address, and identifying infrastructure details to protect privacy and follow responsible disclosure. Responsible disclosure means reporting security issues privately to the organisation so they can fix them before details become public.
What I Tested
The testing focused on a harmless query parameter:
?test=TEST123
This is a URL query string with one parameter named test and the value TEST123. The question mark starts the query string, test is the parameter name, and TEST123 is the value.
They then tested several representations, including:
?test=%2F
This is the same parameter but with the value %2F, which is the percent-encoded form of the forward slash /. The researcher wanted to see how the application handles an encoded slash, because slashes often have special meaning in URLs (they separate path segments).
?test=%252F
This is double encoding: %252F decodes once to %2F, and if decoded again it becomes /. The researcher wanted to see whether the application decodes once or twice, because that difference can matter for security.
?test=%54%45%53%54%31%32%33
This is the hex-encoded form of TEST123. Each character is replaced by its percent-encoded byte: T is %54, E is %45, S is %53, T is %54, 1 is %31, 2 is %32, 3 is %33. The researcher wanted to see if the application decodes these before processing.
?test=%EF%BC%B4%EF%BC%A5%EF%BC%B3%EF%BC%B4
This is the full-width Unicode representation of TEST. The bytes EF BC B4 represent the full-width T, EF BC A5 represent the full-width E, EF BC B3 represent the full-width S, and EF BC B4 again represent the full-width T. The researcher wanted to see if the application treats full-width characters differently from ASCII characters.
These tests were designed to observe URL parsing and canonicalisation behaviour without attempting to access protected resources. URL parsing is the process of breaking a URL into its components (scheme, host, path, query, etc.). Canonicalisation, as explained earlier, is standardising the representation.
Tools
The testing was performed from an Android/Termux environment using standard command-line tools, primarily:
curldiffcmpgrepddwc
Termux is a terminal emulator for Android that provides a Linux-like environment. A command-line tool is a program you run by typing its name in a terminal. Here is what each tool does:
curlis a tool for sending HTTP requests and displaying responses. You can use it to fetch a web page or API endpoint from the command line.diffcompares two files line by line and shows the differences.cmpcompares two files byte by byte and reports the first difference.grepsearches for patterns in text.ddcopies and converts data, often used for low-level file operations.wccounts lines, words, and bytes in files.
This was useful because it demonstrated that meaningful web-security testing can be performed from a mobile environment when the testing is appropriately scoped. Scoped means limited to a specific target and set of actions, with permission.
Sanitised Results
The sanitised results were recorded as follows:
| Test | Result | Observation |
|---|---|---|
| Normal ASCII input | 200 / 301 | Response behaviour varied between requests |
| URL-encoded "/" | 301 | Application redirected while preserving the encoded representation |
| Double URL encoding | 200 | Application returned the page without the observed redirect |
| Hex-encoded "TEST123" | 301 | Application canonicalized the value to "TEST123" |
| Full-width Unicode "TEST" | 200 | Application returned the page without the observed canonicalization redirect |
Let's explain each row:
- Normal ASCII input: sending
?test=TEST123sometimes returned 200 and sometimes 301. The behaviour varied between requests; the report does not say why. - URL-encoded "/": sending
?test=%2Freturned 301. The application redirected while preserving the encoded representation. - Double URL encoding: sending
?test=%252Freturned 200. The application returned the page without the redirect seen for the single-encoded slash. - Hex-encoded "TEST123": sending
?test=%54%45%53%54%31%32%33returned 301. The application canonicalised the value toTEST123, meaning it decoded the percent-encoded characters before redirecting. - Full-width Unicode "TEST": sending
?test=%EF%BC%B4%EF%BC%A5%EF%BC%B3%EF%BC%B4returned 200. The application returned the page without the canonicalisation redirect seen for ASCII input.
The hexadecimal test was particularly clear. The request contained:
%54%45%53%54%31%32%33
The application returned a redirect whose destination contained:
TEST123
This indicates that the application was decoding the percent-encoded characters before applying its canonicalisation logic. In other words, it took the encoded form, turned it into plain text, and then used that plain text in the redirect.
Investigating the Unicode Response
The Unicode representation behaved differently from the ASCII representation. The Unicode request returned an HTTP 200 response instead of the observed 301 response.
At first, this looked potentially interesting because different normalization paths can sometimes result in security-control inconsistencies. A security control is a mechanism like a WAF, an authentication check, or an authorization check. If one path normalises input differently, security controls might end up evaluating different representations.
I therefore downloaded both responses and compared them. Both responses were:
182,597 bytes
However, the files were not byte-for-byte identical. Byte-for-byte means every single byte is the same. Even though the sizes were equal, the contents differed somewhere.
Rather than assuming that the difference represented a security issue, I investigated the exact locations where the files differed. The differences occurred around dynamically generated identifiers associated with the site's translation widget. A translation widget is a feature that lets users switch languages; the report says the differing regions held dynamically generated identifiers associated with it. These identifiers can change between requests even for the same input, so they are not evidence of a security issue.
After examining the surrounding HTML, the differences were determined to be dynamic content rather than evidence that the Unicode input was being interpreted as executable or security-sensitive content. Executable content would be something like JavaScript that runs in the browser; security-sensitive content could be a password or a token.
What I Learned
The most important lesson from this test was:
A different HTTP response does not automatically mean a vulnerability.
It is easy during security testing to see something like:
ASCII → 301
Unicode → 200
and immediately assume that a WAF bypass or normalization vulnerability exists. A WAF bypass means getting a request past a Web Application Firewall that would normally block it. A normalization vulnerability is a flaw where inconsistent canonicalisation leads to a security problem.
That conclusion would have been premature. Premature means jumping to a conclusion before gathering enough evidence.
The response bodies needed to be compared before assigning security significance to the behaviour. The response body is the content of the HTTP response, such as the HTML of a page.
In this case, the meaningful difference turned out to be dynamically generated page content rather than a demonstrated security-control bypass.
Security Assessment
Based on the testing performed, I did not demonstrate:
- Authentication bypass: logging in without valid credentials.
- Authorization bypass: accessing resources or actions without permission.
- Access to restricted resources: viewing files or pages that should be protected.
- Sensitive information disclosure: leaking private data.
- Code execution: running arbitrary code on the server.
- A confirmed WAF bypass: getting past the Web Application Firewall.
- A confirmed URL-normalization vulnerability: a security flaw due to inconsistent URL canonicalisation.
Therefore, the result was classified as:
Informational / Low
rather than a confirmed vulnerability. Informational means it is an observation, not a security flaw.
Why Canonicalization Matters
URL canonicalisation becomes particularly important when multiple components process a request. A simplified request path might look like:
Client
↓
CDN / WAF
↓
Web Server
↓
Application Framework
↓
Backend
This diagram shows the layers a request passes through. The client is your browser. The CDN/WAF is the first line of defence. The web server handles the HTTP connection. The application framework is the code that implements the site's logic. The backend is the database or other services.
If one layer decodes an input once while another layer decodes it twice, the components may end up evaluating different representations of the same request. For example:
can become:
while:
%252F
can become:
after one decoding operation and potentially:
after a second.
That difference can become security-relevant when the value controls routing, file access, authorization, redirects, or security filtering. Routing is deciding which code handles a request. File access is reading or writing files. Authorization is checking permissions. Redirects are sending the browser to another URL. Security filtering is blocking malicious input.
Responsible Testing
This assessment was performed against an authorized target using harmless input. Authorized means the researcher had permission from the owner.
I intentionally avoided:
- Credential attacks: trying to guess or steal passwords.
- Destructive requests: requests that could delete or modify data.
- Data modification: changing data without permission.
- Authentication bypass attempts: trying to log in without credentials.
- Accessing private information: viewing data that is not public.
- Exploitation of unrelated third-party infrastructure: attacking systems not owned by the target.
The objective was to observe application behaviour while minimizing impact. Minimizing impact means causing as little disruption as possible.
Conclusion
This assessment was a useful demonstration of why security testing requires careful validation. Validation means confirming that an observation is actually a security issue.
Encoding differences can look suspicious, but identifying a genuine vulnerability requires demonstrating a security impact. A genuine vulnerability is a real flaw that can be exploited. Security impact is the harm that could result.
In this case, the testing showed differences in URL canonicalisation behaviour, but the available evidence did not demonstrate an exploitable security issue. Exploitable means an attacker could actually use it to cause harm.
For me, the biggest takeaway was simple:
«Don't stop at the interesting response. Investigate why it happened.»
That mindset is important in penetration testing because a strange response is an observation, not necessarily a vulnerability. Penetration testing is authorized simulated attacks to find security issues.
Disclaimer
This article describes an authorized security assessment conducted for educational and professional security-testing purposes.
The target organization, domain, IP address, and identifying infrastructure information have been intentionally omitted.
No claim of vulnerability is being made against the redacted organization based on the testing described here.
Glossary
- API: Application Programming Interface; a set of rules that lets one program talk to another.
- ASCII: A character encoding standard for English letters, digits, and symbols.
- Authentication: The process of verifying who you are, like logging in.
- Authorization: The process of checking what you are allowed to do.
- Backend: The server-side part of an application that handles data and logic.
- Byte: A unit of digital information, typically 8 bits; a single character in ASCII is one byte.
- Canonicalisation: The process of converting different representations of the same value into a standard form.
- CDN: Content Delivery Network; a system of distributed servers that deliver web content.
- Client: The software that sends requests, usually a web browser.
- Command-line tool: A program run by typing commands in a terminal.
- Cookie: A small piece of data stored by the browser and sent with requests to identify a session.
- Credential: Information used to prove identity, such as a username and password.
- curl: A command-line tool for sending HTTP requests.
- dd: A command-line tool for copying and converting data.
- diff: A command-line tool that compares files line by line.
- cmp: A command-line tool that compares files byte by byte.
- Decoding: Converting encoded data back to its original form.
- Dynamic content: Content that changes each time it is generated, such as a timestamp or random ID.
- Encoding: Converting data into a different format, often to make it safe for transmission.
- Exploit: A technique that takes advantage of a vulnerability.
- Full-width: A Unicode character form that is wider, often used in East Asian text.
- grep: A command-line tool for searching text patterns.
- Hex-encoded: Represented using hexadecimal digits, often with percent signs in URLs.
- HTTP: Hypertext Transfer Protocol; the protocol used for web requests and responses.
- HTTP 200: Status code meaning OK; the request succeeded.
- HTTP 301: Status code meaning Moved Permanently; the resource is at a different URL.
- IP address: A numeric address that identifies a device on a network.
- Parameter: A named value in a URL query string or form data.
- Payload: The part of a request that carries the data being tested.
- Percent-encoding: A way to encode characters in a URL using
%followed by two hex digits. - Query parameter: A key-value pair in the part of a URL after the question mark.
- Redirect: An HTTP response that tells the browser to go to a different URL.
- Response body: The content of an HTTP response, such as HTML.
- Routing: The process of deciding which code handles a request based on the URL.
- Sanitised: Modified to remove sensitive or identifying information.
- Scoped: Limited to a specific target and set of actions.
- Security control: A mechanism that enforces security, like a WAF or authentication check.
- Session: A period of interaction between a user and a website, often tracked with a cookie.
- Status code: A three-digit number in an HTTP response indicating the outcome.
- Termux: A terminal emulator for Android.
- Token: A piece of data used to authenticate or identify a session, often a string.
- Unicode: A standard for representing characters from all writing systems.
- URL: Uniform Resource Locator; the address of a resource on the web.
- URL parsing: Breaking a URL into its components.
- Vulnerability: A weakness that can be exploited to cause harm.
- WAF: Web Application Firewall; a security filter for HTTP traffic.
- wc: A command-line tool that counts lines, words, and bytes.
- Web server: Software that serves web content and handles HTTP requests.