【发布时间】:2012-04-24 04:20:54
【问题描述】:
所以我正在处理的网站之一显然存在 xss 漏洞。
正常的html是这样的:
<form name="contact_us" action="somewhere" method="post">
<div id="contactUsNoticeContent" class="content"></div>
<fieldset id="contactUsForm">
<legend>Contact Us</legend>
<div class="alert forward">* Required information</div>
<label class="inputLabel" for="contactname">Full Name:</label>
<input type="text" name="contactname" size="40" id="contactname"><span class="alert">*
</span><br class="clearBoth">
<label class="inputLabel" for="email-address">Email Address:</label>
<input type="text" name="email" size="40" id="email-address"><span class="alert">*
</span><br class="clearBoth">
<label for="enquiry">Message:<span class="alert">*</span></label>
<textarea name="enquiry" cols="30" rows="7" id="enquiry"></textarea>
</fieldset>
<div class="buttonRow forward"><input type="image"src="an image src" alt="Send Now"
title=" Send Now "></div>
<div yourface" alt="Back" title=" Back " width="85" height="25"></a></div>
</form>
他们将以下代码作为漏洞发回给我:
<input type="text" name="email" value="
<s cript>alert('S AINTL2NvbnRhY3RfdX MuaHRtbD9hY3Rpb249c2VuZ CBlbWFpbA==')
</s cri pt>" s ize="40" id="emailaddress " /><s pan clas s ="alert">*</s pan>
<br clas s ="clearBoth" />
重绘$value的代码是原始帖子数据:
$field = '<input type="' . zen_output_string($type) . '" name="' .
zen_output_string($name) . '"';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= ' />';
我猜当提交表单时,应该在页面重新加载时显示警报?我似乎无法触发这个。我认为我需要做的就是在将其重新发布到表单以修复它之前摆脱该值,但现在我有点好奇我做错了什么,我似乎无法触发它。任何人都知道如何重现这个或我做错了什么?
它位于带有已知漏洞的旧 zen cart 框架上。但我想了解它们,而不仅仅是安装补丁。 Zen function reference
【问题讨论】:
-
您实际上并未在此处显示任何代码。您如何期待任何有用的反馈?
-
注意:
L2NvbnRhY3RfdX MuaHRtbD9hY3Rpb249c2VuZ CBlbWFpbA==是"/contact_us.html?action=send email"的 base64 编码表示(不带引号)。 -
@amber:你需要什么控制器代码来查看正在做什么转义?
-
经验法则是,如果您向用户回显某些内容,例如他的姓名、电子邮件等,您从表单中收到 &(failed to sanitize),那么您应该将其传递给
htmlentities()在你看来。在名称或此类内容的表中存储长度为varchar(255)或TEXT将允许插入更大的攻击代码 -
我尝试将以下内容放入输入并提交,但我无法让它产生警报:
alert('S AINTL2NvbnRhY3RfdX MuaHRtbD9hY3Rpb249c2VuZ CBlbWFpbA==')cript >" s ize="40" id="emailaddress" />*pan>
标签: php javascript xss zen-cart