Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
生PHPで学ぶSSRF.pdf
Search
dyoshikawa
October 08, 2024
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
生PHPで学ぶSSRF.pdf
dyoshikawa
October 08, 2024
More Decks by dyoshikawa
See All by dyoshikawa
エンジニア向けコミュニティZennの開発チームを支える自動化の仕組み.pdf
dyoshikawa1993
0
2.7k
Zennへのスパム投稿が急増したのでLLMでなんとかした話
dyoshikawa1993
0
1.6k
Google Cloud Vertex AIにおけるGemini vs Claude
dyoshikawa1993
0
250
OSSコミットしてZennの課題を解決した話
dyoshikawa1993
0
750
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
142
7.8k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Skip the Path - Find Your Career Trail
mkilby
1
260
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Ruling the World: When Life Gets Gamed
codingconduct
0
410
Transcript
生PHPで学ぶSSRF 10/19(土) PHP勉強会in広島 vol.1 LT枠 @dyoshikawa
簡単に自己紹介 • https://x.com/dyoshikawa1993 • 広島住みソフトウェアエンジニア • Next.js / Ruby on
Rails など • 応用情報技術者 / AWS Security Specialtyなど
留意事項 • 発表者もセキュリティ勉強中の身です(予防線) • コードは例示のために簡略化されているため、そのまま本番利用はしないでくださ い • 誤りがあればご指摘ください
SSRF知ってますか?
https://owasp.org/Top10/ja/ OWASP Top 10に入っている
私のSSRFとの出会い • 今年(2024年)春に応用情報技術者試験合格 • 秋に情報処理安全確保支援士試験を申し込み • SSRF(サーバーサイドリクエストフォージェリ)を知る • CSRF(クロスサイトリクエストフォージェリ)は聞いたことあるけど、SSRFって何 ・・・?
SSRFとは
SSRFとは ネットワーク 公開サーバ 非公開サーバ 192.168.0.1 https://example.com として公開 GET https://example.com?target=http://192.168.0.1 任意のURLをパラメータとして受け付けて内容を取得するような
Webアプリケーションの場合に 攻撃者がWebサーバ自身や非公開のサーバの情報を取得できてしまう脆弱性
任意のURLを受け付ける生PHP ※脆弱なコードです
任意のURLを受け付けるWebアプリなんかある? 実は結構ある • ChatGPTに任意のURLを渡して「このページを要約して」と依頼 • XやFacebookに任意のURLを渡してリンクカード(OGP)を表示
どうすればいいの?
SSRF対策 • 可能であれば、任意のURLを受け付ける仕様をやめる • URLをホワイトリストで管理して検証する、IDとURLのテーブルを作ってIDを受け取 るようにするなど
URLをホワイトリストで制限
とはいえ仕様がそれを許さない場合もある • 任意のURLを受け付けないと機能要件が満たせない場合、決定版な対策はない • ネットワーク分離 +、形式の検証、WAF、生のレスポンスをそのままクライアントに返さない など組み合わせて対策する • ブラックリスト方式はダメ、簡単に迂回される https://owasp.org/Top10/ja/A10_2021-Server-Side_Request_Forgery_%28SSRF%29/
参考 • https://owasp.org/Top10/ja/ • https://owasp.org/Top10/ja/A10_2021-Server-Side_Request_Forgery_%28SS RF%29/ • https://blog.tokumaru.org/2018/12/introduction-to-ssrf-server-side-request-forg ery.html •
https://zenn.dev/chot/articles/88ea57e3108978 • https://www.docswell.com/s/wild0ni0n/5DENY9-2023-05-08-115632
Thank you