Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DOM Based XSSの自動検出の話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
tanakayu
November 21, 2016
Research
3
2.5k
DOM Based XSSの自動検出の話
Shibuya.XSS#8
tanakayu
November 21, 2016
Tweet
Share
Other Decks in Research
See All in Research
ドメイン知識がない領域での自然言語処理の始め方
hargon24
1
260
2025-11-21-DA-10th-satellite
yegusa
0
130
その推薦システムの評価指標、ユーザーの感覚とズレてるかも
kuri8ive
1
340
An Open and Reproducible Deep Research Agent for Long-Form Question Answering
ikuyamada
0
340
離散凸解析に基づく予測付き離散最適化手法 (IBIS '25)
taihei_oki
PRO
1
720
「車1割削減、渋滞半減、公共交通2倍」を 熊本から岡山へ@RACDA設立30周年記念都市交通フォーラム2026
trafficbrain
1
710
Thirty Years of Progress in Speech Synthesis: A Personal Perspective on the Past, Present, and Future
ktokuda
0
190
第66回コンピュータビジョン勉強会@関東 Epona: Autoregressive Diffusion World Model for Autonomous Driving
kentosasaki
0
470
2026年3月1日(日)福島「除染土」の公共利用をかんがえる
atsukomasano2026
0
420
Off-Policy Evaluation and Learning for Matching Markets
yudai00
0
100
2026 東京科学大 情報通信系 研究室紹介 (すずかけ台)
icttitech
0
650
データサイエンティストの業務変化
datascientistsociety
PRO
0
290
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
290
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
84
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.4k
What does AI have to do with Human Rights?
axbom
PRO
1
2k
The browser strikes back
jonoalderson
0
770
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
390
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
320
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
How to train your dragon (web standard)
notwaldorf
97
6.5k
Site-Speed That Sticks
csswizardry
13
1.1k
Thoughts on Productivity
jonyablonski
75
5.1k
Fireside Chat
paigeccino
42
3.8k
Transcript
DOM Based XSSを 全自動検出したい話 tanakayu 11/14 @Shibuya.XSS#8
今日話すこと •DOM Based XSSを全自動検出するには • DOM Based XSS の検出手法事情 •
実際に既存ツールを用いて実験してみる • 結果をもってより良いものを目指してみる ユーザに依存せず正確かつ自動的に検出したい
昨今のXSS事情 •サーバ型XSSに大きな変化はなし •クライアント型XSS(DOM Based XSS)はよ り複雑さを増している •DOM Based XSS の検出手法は現在も提案され
続けている
DOM Based XSS •クライアントサイドスクリプトに起因するXSS •Source(入力箇所)の文字列がSink(出力箇 所)でエスケープされていない際に起こりうる •http://example.jp# Source Sink 【脆弱なコード例】
<script>alert(1)</script>
探し方 •JavaScriptを頑張って読む • SourceからSinkの流れを頭で想像しながら追う • JavaScript力が求められる •ブラウザのデバッガを使いつつ頑張る • 値の受け渡し等を実際に動作を確認しながら追う •
デバッガ力が求められる
•JavaScriptを頑張って読む • SourceからSinkの流れを頭で想像しながら追う • JavaScript力が求められる •ブラウザのデバッガを使いつつ頑張る • 値の受け渡し等を実際に動作を確認しながら追う • デバッガ力が求められる
探し方(自動編) 静的解析 動的解析
静的解析 •ソースコードからSourceとSinkを探査 • 正規表現でのパターンマッチとか ScanJS:https://github.com/mozilla/scanjs
問題 •ダイナミックなコード生成 •Anonymous function •難読化 ⇒XSSの可否はユーザが確認 Jjencode: http://utf-8.jp/public/jjencode.html 今回の目的には合わない...
動的解析 •テイント解析 1. Sourceにテイントタグを付与 2. テイントタグの伝搬を追跡 3. Sinkの状態を確認 Source Sink
Propagation tag tag document.URL location.search location.hash document.write innerHTML window.location String.slice() String.split() String.replace() … … … tag Check!
既存ツール •DOMinator • Firefox(SpiderMonkeyを改造) • 元祖 •Tainted PhantomJS • QtWebKit(JavaScriptCoreを改造)
• BlackHat Asia 2014 •Hookish • Chrome拡張 • BlackHat US 2015 TaintedPhantomJS:https://github.com/neraliu/tainted-phantomjs/ DOMinator Pro:https://www.blueclosure.com/ Hookish:http://hookish.skepticfx.com/
Tainted PhantomJS •テイント解析とJavaScript(alert())動作で 脆弱か判定 •Tainted? • True or False •Alert?
• True or False
実験 •Firing Range • Google製のWebセキュリティ検査ツールのテスト ベッド https://public-firing-range.appspot.com/
結果(良い点) •FalsePositiveはゼロ • Taint & Alert の二重チェック • 定義されているSource/Sinkについては追えている •URLを渡すだけで実際にXSSできるところまで
確認することができる
結果(惜しい点) •定義されていないSinkが検出できない • URLや他リソースがSinkとなるもの • iframe, document.location, etc.. •発火にユーザ操作が必要なものを検出できない •
<a href=…, <form action=…, etc.. •location.search等の一部Sourceは完全検出できない (taint判定は可能) • ブラウザに依存する問題
改良 •検出ロジックの追加 • JavaScriptの動作と、それが攻撃コードによるもの かを確認 ⇒alert()で表示する文字列の確認 •攻撃コードの追加 • javascript:alert(1) •
data;text/html,alert(1) • etc… •攻撃完了後に使用したペイロードの存在を確認 • <a href=“javascript:alert(1)”>
いざ、再びのFiring Range •ユーザ操作が必要なものを検出できない • <a href=…、<form action=… •URLや他リソースがSinkとなるものが検出でき ない •
iframe、document.location、… •location.search等の一部Sourceは完全検出で きない(taint判定は可能) • ブラウザに依存する問題 クリア!! クリア!! ムリ!!
最終結果 •Sinkカバー率が上がった •ブラウザに依存する問題はどうにもならない document write innerHtml document writeln document. write
innerHtml document. writeln a.href embed.src document. location eval function form.action iframe.src range.creat eContextua lFragment object.data script.href setTimeout script.src Sourceをlocation.hashとした時に検出できたSink一覧
まとめと展望 •動的解析結構いいんじゃない? • 結構見つけてくれた • 検査結果の信頼性も高い •ソースコードからXSSパターンを学習させて ペイロードを生成できたら良さそう • 答えは全てクライアントにある