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
2.5k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DOM Based XSSの自動検出の話
Shibuya.XSS#8
tanakayu
November 21, 2016
Other Decks in Research
See All in Research
コーディングエージェントとABNを再考
hf149
2
720
進学校の生徒にはア行の苗字が多いのか
ozekinote
0
450
Ghost in the 7‑Zip: The Shadow of Residential Proxies Creeping into Your Life
nttcom
0
1.2k
AY 2026 Guide to Academic Writing Using Generative AI - Workshop
ks91
PRO
0
120
The Landscape of Agentic Reinforcement Learning for LLMs: A Survey
shunk031
4
1k
計算情報学研究室(数理情報学第7研究室)2026
tomohirokoana
0
570
Model Discovery and Graph Simulation: A Lightweight Gateway to Chaos Engineering
anatolykr
0
200
Sequences of Logits Reveal the Low Rank Structure of Language Models
sansantech
PRO
1
260
2026-01-30-MandSL-textbook-jp-cos-lod
yegusa
1
1.3k
SOTAのさらに先へ:厳しい推論制約下での高性能モデルのPost-Training
analokmaus
0
1.3k
老舗ものづくり企業でリサーチが変革を起こすまで - 三菱重工DXの実践
skydats
0
190
Fukui Shibiten 39 - AI Art
butchi
0
130
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The Invisible Side of Design
smashingmag
302
52k
30 Presentation Tips
portentint
PRO
1
330
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
HDC tutorial
michielstock
2
720
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
From π to Pie charts
rasagy
0
210
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
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パターンを学習させて ペイロードを生成できたら良さそう • 答えは全てクライアントにある