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
難読化Bashの検知
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
udon-yuya
November 28, 2020
Technology
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
難読化Bashの検知
udon-yuya
November 28, 2020
More Decks by udon-yuya
See All by udon-yuya
NTTコミュニケーションズ インターンシップレポート
udonyuya
1
1k
Other Decks in Technology
See All in Technology
PHPで作って学ぶリアルタイム音声対話AIとWebSocket入門 by ムナカタ
munakata
0
160
OpenTelemetryにおけるGoのゼロコード・コンパイル時計装について #fukuokago
quiver
0
330
そのドキュメント、自動化しませんか?
yuksew
1
440
AIエージェントがあれば技術書なんてすぐ書けるでしょ→無理でした
watany
5
480
Claude CodeとAmazon Bedrock AgentCoreでつくる、自分だけのAIアシスタント
ymae
0
110
データエンジニアリングとドメイン駆動設計
masuda220
PRO
14
2.7k
どこまでAIに任せるか 〜確率論と決定論の境界決定〜
shukob
0
530
それでも、技術なブログを書く理由 #kichijojipm / Why I Still Write Tech Blogs Even Now
shinkufencer
0
950
Playwright × AI Agent でE2Eテストはどう変わるか AI駆動テストの可能性と実用検証の結果
taiga7543
2
880
CTOキーノート:AI時代の「つなぐ」を再定義 ― 真のIoTとリアルワールドAI【SORACOM Discovery 2026】
soracom
PRO
0
130
仕様駆動開発、導入半年。「本当に速くなってるの?」にデータで答える / AICon2026_hirakawa
rakus_dev
0
360
ソフトウェアアーキテクチャ研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
2
530
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
500
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Building Adaptive Systems
keathley
44
3.1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Game over? The fight for quality and originality in the time of robots
wayneb77
1
230
How to train your dragon (web standard)
notwaldorf
97
6.7k
The SEO identity crisis: Don't let AI make you average
varn
0
520
Paper Plane (Part 1)
katiecoart
PRO
1
9.8k
The Language of Interfaces
destraynor
162
27k
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