Bypassing the XSS Filters : Advanced XSS Tutorials for Web application Pen Testing

本文详细解析了如何绕过XSS过滤器,包括使用ASCII字符、HEX编码、混淆关键字和关闭标签等方法,确保攻击者能够成功注入恶意脚本。
Hi friends, last time, i explained  what is XSS  and how an attacker can inject malicious script in your site. As i promised earlier, i am writing this advanced XSS  tutorial  for you(still more articles will come).

Sometimes, website owner use XSS  filters (WAF) to protect against XSS vulnerability.
For eg: if you put the <scirpt>alert("hi")</script> , the  Filter  will escape the "(quote) character , so the script will become
<script>alert(>xss detected<)</script>
Now this script won't work. Likewise  Filters  use different type of  filtering  method to give protection against the XSS.  In this case, we can use some tricks to bypass the  filter .  Here i am going to cover that only. 

1.Bypassing magic_quotes_gpc

The magic_quotes_gpc=ON is a PHP setting(configured in PHP.ini File) , it escapes the every ' (single-quote), " (double quote) and \  with a backslash automatically.
For Eg:
<scirpt>alert("hi");</script> will be filtered as <script>alert(\hi\)</script>.so the script won't work now. 

This is well known  filtering  method, but we can easily bypass this  filter  by using ASCII characters instead.
For Eg:  alert("hi"); can be converted to
String.fromCharCode(97, 108, 101, 114, 116, 40, 34, 104, 105, 34, 41, 59)
so the script will become <script>String.fromCharCode(97, 108, 101, 114, 116, 40, 34, 104, 105, 34, 41, 59)</script>.  In this case there is no "(quotes) or '(single quotes) or / so the  filter  can't  filter  this thing.  Yes, it will successfully run the script.
String.fromCharCode() is a javascript function that converts ASCII value to Characters.

How to convert to ASCII values?

There are some online sites that converts to ASCII character. But i suggest you to use  Hackbar Mozilla addon  .

After installing hackbar add on ,press F9.  It will open the small box above the url bar. click the XSS->String.fromCharCode()

Now it will popup small window. enter the code for instance alert("Hi").  click ok button.  Now we got the output.

copy the code into the <script></script> inside and insert in the vulnerable sites

For eg: 
hxxp://vulnerable-site/search?q=<script>String.fromCharCode(97, 108, 101, 114, 116, 40, 34, 104, 105, 34, 41, 59)</script>

2.HEX Encoding

we can encode our whole script into HEX code so that it can't be filtered. 
For example:  <script>alert("Hi");</script> can be convert to HEX as:
%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%22%48%69%22%29%3b%3c%2f%73%63%72%69%70%74%3e
Now put the code in the vulnerable site request.
For ex: 
hxxp://vulnerable-site/search?q=%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%22%48%69%22%29%3b%3c%2f%73%63%72%69%70%74%3e
 Converting to HEX:
This site will convert to hex code: http://centricle.com/tools/ascii-hex/ 

3.Bypassing using Obfuscation

Some website admin put the  script , alert  in restricted word list.  so whenever you input this  keywords , the  filter  will remove it and will give error message like "you are not allowed to search this". This can bypassed by changing the case of  the keywords (namely Obfuscation).  
For eg:
<ScRipt>ALeRt("hi");</sCRipT>

This bypass technique rarely works but giving trial is worth. 

4. Closing Tag

Sometimes putting "> at the beginning of the code will work. 

"><script>alert("Hi");</script>

This will end the previous opened tag and open our script tag.
Example:
hxxp://vulnerable-site/search?q="><script>alert("Hi");</script>

Conclusion:
From above article, it is clear that XSS  filters  alone not going to protect a site from the XSS attacks. If you really want to make your site more secure, then ask PenTesters to test your application or test yourself.

Also there are lot of different  filter   bypassing  technique, i just covered some useful techniques for you.
内容概要:本文档是一份关于交换路由配置的学习笔记,系统地介绍了网络设备的远程管理、交换机与路由器的核心配置技术。内容涵盖Telnet、SSH、Console三种远程控制方式的配置方法;详细讲解了VLAN划分原理及Access、Trunk、Hybrid端口的工作机制,以及端口镜像、端口汇聚、端口隔离等交换技术;深入解析了STP、MSTP、RSTP生成树协议的作用与配置步骤;在路由部分,涵盖了IP地址配置、DHCP服务部署(接口池与全局池)、NAT转换(静态与动态)、静态路由、RIP与OSPF动态路由协议的配置,并介绍了策略路由和ACL访问控制列表的应用;最后简要说明了华为防火墙的安全区域划分与基本安全策略配置。; 适合人群:具备一定网络基础知识,从事网络工程、运维或相关技术岗位1-3年的技术人员,以及准备参加HCIA/CCNA等认证考试的学习者。; 使用场景及目标:①掌握企业网络中常见的交换与路由配置技能,提升实际操作能力;②理解VLAN、STP、OSPF、NAT、ACL等核心技术原理并能独立完成中小型网络搭建与调试;③通过命令示例熟悉华为设备CLI配置逻辑,为项目实施和故障排查提供参考。; 阅读建议:此笔记以实用配置为主,建议结合模拟器(如eNSP或Packet Tracer)动手实践每一条命令,对照拓扑理解数据流向,重点关注VLAN间通信、路由选择机制、安全策略控制等关键环节,并注意不同设备型号间的命令差异。
多旋翼无人机组合导航系统-多源信息融合算法(Matlab代码实现)内容概要:本文围绕多旋翼无人机组合导航系统,重点介绍了基于多源信息融合算法的设计与实现,利用Matlab进行代码开发。文中采用扩展卡尔曼滤波(EKF)作为核心融合算法,整合GPS、IMU(惯性测量单元)、里程计和电子罗盘等多种传感器数据,提升无人机在复杂环境下的定位精度与稳定性。特别是在GPS信号弱或丢失的情况下,通过IMU惯导数据辅助导航,实现连续可靠的位姿估计。同时,文档展示了完整的算法流程与Matlab仿真实现,涵盖传感器数据预处理、坐标系转换、滤波融合及结果可视化等关键环节,体现了较强的工程实践价值。; 适合人群:具备一定Matlab编程基础和信号处理知识,从事无人机导航、智能控制、自动化或相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于多旋翼无人机的高精度组合导航系统设计;②用于教学与科研中理解多传感器融合原理与EKF算法实现;③支持复杂环境下无人机自主飞行与定位系统的开发与优化。; 阅读建议:建议结合Matlab代码与理论推导同步学习,重点关注EKF的状态预测与更新过程、多传感器数据的时间同步与坐标变换处理,并可通过修改噪声参数或引入更多传感器类型进行扩展实验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值