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

本文详细解析了如何绕过XSS过滤器,包括使用ASCII字符、HEX编码、混淆关键字和关闭标签等方法,确保攻击者能够成功注入恶意脚本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.
内容概要:本文档详细介绍了基于Python的在线二手电子产品回收系统的设计与实现。项目旨在通过构建一个可靠、安全、透明的平台,提高废旧电子产品的回收率,推动资源的合理再利用,提供安全可靠的交易平台,加强环保意识,促进二手市场的发展,并实现数据驱动的智能化服务。项目面临的主要挑战包括废旧电子产品的检测与评估、信息不对称与交易风险、市场需求的预测与定价、用户体验优化及平台的安全性与数据保护。解决方案涵盖智能化评估与回收定价、高效的二手产品处理流程、完善的售后保障体系、创新的市场需求分析、全程透明化与安全性保障以及定制化用户体验。系统采用微服务架构,包括用户管理、商品评估、交易管理、数据分析、支付与结算等模块。项目还涉及前端界面设计、API接口开发、数据库设计与实现、模型训练与优化、部署与应用等方面。 适合人群:具备一定编程基础,特别是对Python和Web开发有一定了解的研发人员,以及对二手电子产品回收和环保事业感兴趣的从业者。 使用场景及目标:①帮助用户方便地将闲置电子产品回收、交易或再利用,提高废旧电子产品的回收率;②通过智能化的数据分析为用户提供价格评估、市场需求分析等服务,提高回收效率;③提供安全可靠的交易平台,确保交易的公平性和安全性;④推动二手市场的健康发展,为消费者提供经济实惠的产品选择;⑤增强公众的环保意识,推动社会向绿色、低碳方向发展。 其他说明:本文档不仅提供了系统的功能模块设计、数据库表结构、API接口规范,还展示了具体代码实现和GUI界面设计,为开发者提供了全面的技术参考。此外,项目强调了数据安全和隐私保护的重要性,确保平台在运行过程中能够有效保护用户信息。项目未来改进方向包括增强模型的精准度、拓展国际市场、提供更多支付和融资选项、跨平台数据集成与分析、更加智能的回收流程以及强化社交化与社区功能。
内容概要:本文档详细介绍了基于C语言和单片机设计的固态继电器驱动空调温控系统,涵盖了从硬件电路设计、程序设计、GUI设计到代码详解的完整流程。项目旨在实现高效精准的温度控制、提升系统可靠性和寿命、灵活的参数设置和人机交互、降低能耗、模块化设计便于扩展与维护,以及促进智能家居与工业自动化发展。项目通过高精度温度采集与滤波算法、固态继电器驱动与保护电路设计、滞环控制算法、多层次软件模块化设计等创新点,确保系统的高效节能、智能化和高可靠性。; 适合人群:具备一定单片机和C语言编程基础的研发人员,尤其是从事嵌入式系统设计、智能家居和工业自动化领域的工程师。; 使用场景及目标:①实现高效精准的温度控制,确保室内温度维持在理想范围;②提升系统可靠性和寿命,减少故障率和维护成本;③支持灵活的参数设置和用户友好的人机交互界面,提升用户体验;④降低能耗,实现节能控制,推动绿色建筑和节能环保产业的发展;⑤通过模块化设计,便于后续功能升级和系统扩展,如远程监控、数据分析等智能化功能。; 其他说明:项目设计充分考虑了实际应用中的挑战,如温度采集的精度与稳定性、电气兼容性、系统响应速度与控制稳定性、软件设计的资源优化与抗干扰等,提出了针对性的解决方案。系统不仅适用于家庭智能空调,还能广泛应用于工业、商业建筑、医疗环境及农业温室等多个领域。未来改进方向包括智能温度预测与自适应控制、多传感器融合技术应用、远程监控与云平台集成、低功耗与绿色节能优化等。通过该系统,不仅能够精确控制室内温度,保障舒适环境,还能有效节能,延长设备使用寿命,具有重要的实际应用价值和推广意义。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值