Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
難読化Bashの検知
Search
udon-yuya
November 28, 2020
Technology
0
190
難読化Bashの検知
udon-yuya
November 28, 2020
Tweet
Share
More Decks by udon-yuya
See All by udon-yuya
NTTコミュニケーションズ インターンシップレポート
udonyuya
1
970
Other Decks in Technology
See All in Technology
Knowledge Work の AI Backend
kworkdev
PRO
0
280
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.9k
アプリにAIを正しく組み込むための アーキテクチャ── 国産LLMの現実と実践
kohju
0
230
AgentCoreとStrandsで社内d払いナレッジボットを作った話
motojimayu
1
990
ハッカソンから社内プロダクトへ AIエージェント「ko☆shi」開発で学んだ4つの重要要素
sonoda_mj
6
1.7k
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
490
Introduce marp-ai-slide-generator
itarutomy
0
130
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
13k
子育てで想像してなかった「見えないダメージ」 / Unforeseen "hidden burdens" of raising children.
pauli
2
330
モダンデータスタックの理想と現実の間で~1.3億人Vポイントデータ基盤の現在地とこれから~
taromatsui_cccmkhd
2
270
LayerX QA Night#1
koyaman2
0
270
Amazon Quick Suite で始める手軽な AI エージェント
shimy
2
1.9k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
What the history of the web can teach us about the future of AI
inesmontani
PRO
0
380
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
270
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
How to make the Groovebox
asonas
2
1.8k
Ruling the World: When Life Gets Gamed
codingconduct
0
100
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
72
Bash Introduction
62gerente
615
210k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
45
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
870
KATA
mclloyd
PRO
33
15k
Transcript
Z5. 難読化Bashの検知 セキュリティ・キャンプ2020 Z5トラック 田島 裕也
動機 ・攻撃者は隠蔽のために攻撃用のシェルスクリプトに難 読化処理を施すことがある. ・難読化されたスクリプトを自動で検知することで,攻撃 のバリエーションを減らすことが出来そう. 2
難読化の手法 ・自動で難読化処理を施すツール. ・https://github.com/Bashfuscator/Bashfuscator 3
難読化の手法 $ cat /etc/passwd $ $'\u0063a\x74' /e${@^^}tc/p${*%Frf\[4]}as\s'wd' ・上二つは同じ意味 ・$'\u0063a\x74' ->
cat (unicode, ascii) ・${@^^}, ${*%Frf\[4]} -> empty ・\ は無視される 4
検知するために考えたこと ・難読化されたスクリプトはかなり乱雑に見えるため,エントロピー が高そう. → テキストのエントロピーを計算したところ,正規のスクリプトと 難読化スクリプトであまり変わらない → 人間が見ると,意味のある文字列は乱雑には見えないが,実 際のエントロピーは高い 5
検知するために考えたこと ・難読化されたスクリプトは ‘$’や’{}’,’\’など特殊記号が多く 現れる. → 特殊記号が多く現れるスクリプトを検知 → かなり単純な考えだが,意外とうまくいった. 6
検知基準 ・特殊記号がファイル全体の25%より多く現れる場合,難読 化と検知する. ・閾値適当なの絶対よくない 7
実験・評価 ・難読化マルウェア → 114 / 133 (0.483s) ・正規スクリプト(/bin, /sbin, /usr, /etc, /var/lib)
→ 0 / 1656 (2.120s) ・TP rate = 0.857 ・FP rate = 0 ・Accuracy = (114 + 1656) / (133 + 1656) = 0.989 8
おまけ ・ランダムで追加される意味のない(empty)な部分をなるべく排除 することで,難読化スクリプトを見やすくする. ・無駄な部分が減って何となく見やすくなった... 9
まとめ・感想 ・特殊記号の出現比率を用いて,高い精度で難読化スクリプ トを検知することが出来た. ・正直,こんな難読化が出来ないように規約をもっと厳しいも のにしてもいいんじゃないかと思った. 10