标题基本概括了所有内容。在块内逃逸似乎违反直觉,<noscript>因为攻击者能够注入的任何 js 都不应该被执行。但是,我对此还是很陌生,所以我认为问这个问题是谨慎的。
为了清楚起见,这是我正在谈论的上下文:
<noscript>
<img src="<?php echo 'Should I escape this url' ?>" />
</noscript>
标题基本概括了所有内容。在块内逃逸似乎违反直觉,<noscript>因为攻击者能够注入的任何 js 都不应该被执行。但是,我对此还是很陌生,所以我认为问这个问题是谨慎的。
为了清楚起见,这是我正在谈论的上下文:
<noscript>
<img src="<?php echo 'Should I escape this url' ?>" />
</noscript>
是的。您应该始终逃避不受信任的数据。这是您的代码段(伪代码)的攻击:
<noscript>
<img src="<?php echo 'you should always escape everything,
dependeing on the context. This context is url in an attribute,
you should escape it appropriately. otherwise " />
</noscript>
<script>alert("you will be vulnerable")</script><noscript><img "' ?>" />
</noscript>