HTML第2部分中XXE攻击的基本工作示例

编程入门 行业动态 更新时间:2024-10-25 08:26:04
本文介绍了HTML第2部分中XXE攻击的基本工作示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

请遵循以下步骤: XXE的基本工作示例用HTML攻击

看来,进行此跟进工作要比尝试费劲地解决上一个问题要容易得多.我认为最好让该查询的正确答案显得简单明了.

seemed easier to make this follow up than to try and shoehorn my progress into the previous question. I thought better to allow the correct answer to that query to appear correct plain and simple.

我现在将示例扩展为以下内容:

I have now evolved my example to the following:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <p id="xmlOut"></p> <script type="application/javascript"> var xml = ` <!DOCTYPE foo [ <!ELEMENT foo ANY> <!ENTITY xxe SYSTEM "file:///etc/passwd"> <!ENTITY bar "test that entity substitution works in general"> ]> <foo> display some text | &bar; | &xxe; </foo> `; parser = new DOMParser(); xmlDoc = parser.parseFromString(xml, "text/xml"); document.getElementById("xmlOut").innerHTML = xmlDoc.getElementsByTagName("foo")[0].childNodes[0].nodeValue; </script> </body> </html>

在这里,我以字符串形式编写XML,并使用DOM解析器对其进行解析.一切正常,除了xxe实体未填充任何东西.正如对最后一个问题的回答者所述,firefox似乎有可能阻止外部实体...东西.我也尝试用我的主目录中的文本文件替换,但是那也不起作用.我也尝试给出不带file://前缀的路径.到目前为止没有任何工作.

Here, I'm writing in the XML as a string and parsing it with DOM parser. Everything works as expected, except that the xxe entity is not populated by anything. It does seem possible, as the answerer to the last question stated, that firefox blocks external entity ... stuff. I also tried substituting in a text file in my home directory and that didn't work either. I also tried giving the path without the file:// prefix. Nothing has worked so far.

我可以确认DTD已被解析和使用,所以这是向前迈出的一大步.

I can confirm that the DTD is being parsed and used though, so that's a big step forward.

任何提示均表示感谢!!

Any tips appreciated~!

推荐答案

似乎大多数浏览器都不会加载外部DTD,使得这种类型的xxe攻击很难测试:正确使用XML的外部DTD

seems like most browsers do not load external DTD's making this type of xxe attack pretty hard to test: Proper use of External DTD for XML

但是,如果有人有其他见解,请随时留下答案或评论!

If anyone has any other insight though, feel free to leave an answer or comment!

更多推荐

HTML第2部分中XXE攻击的基本工作示例

本文发布于:2023-11-06 21:30:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564720.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:示例   工作   HTML   XXE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!