微信支付回调XXL注入

本地测试方式
给回调地址发送以下数据

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE Anything [
    <!ENTITY entityex SYSTEM "本地另一个域名">
    ]>
    <abc>&entityex;</abc>

生效则后台爆出异常(此处为java的处理结果)
Error on line 3 of document : 将功能 “http://apache.org/xml/features/disallow-doctype-decl” 设置为“真”时, 不允许使用 DOCTYPE。 Nested exception: 将功能 “http://apache.org/xml/features/disallow-doctype-decl” 设置为“真”时, 不允许使用 DOCTYPE。
未生效有注入的情况
会访问“本地另一个域名”

微信的解决方案
https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=23_5

参考资料

XML文件的解析以及XML外部实体注入防护
https://blog.csdn.net/u013224189/article/details/49759845

java 生成xml

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument()
document.setXmlStandalone(true);
org.w3c.dom.Element xml = document.createElement("xml");
document.appendChild(xml);
org.w3c.dom.Element return_codexml = document.createElement("return_code");
return_codexml.appendChild(document.createCDATASection("SUCCESS"));
xml.appendChild(return_codexml);
org.w3c.dom.Element return_msgxml = document.createElement("return_msg");
return_msgxml.appendChild(document.createCDATASection("OK"));
xml.appendChild(return_msgxml);

org.w3c.dom document 和xml 字符串 互转
https://blog.csdn.net/wmyasw/article/details/8686420

<!CDATA[]]用法详解
https://www.cnblogs.com/bdqczhl/p/7217243.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值