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
ITAC | Websec 2
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
racterub
October 20, 2020
Programming
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ITAC | Websec 2
ITAC | Websec 2
racterub
October 20, 2020
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
180
ITAC | Websec 3
racterub
0
260
ITAC | Websec 1
racterub
0
300
ITAC | Linux Basics
racterub
0
160
Introducing Reverse Engineering @ YZU CS250
racterub
0
240
ITAC | Jinja & Bootstrap
racterub
1
160
ITAC | Flask - Basic Flask
racterub
1
110
ITAC-Flask | Environment setup
racterub
1
140
Other Decks in Programming
See All in Programming
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
APNsからLive Activityを開始する話
yumnumm
0
170
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
3
430
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
220
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
300
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
250
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.7k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
How GitHub (no longer) Works
holman
316
150k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
Paper Plane
katiecoart
PRO
5
54k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
290
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Amusing Abliteration
ianozsvald
1
350
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The SEO Collaboration Effect
kristinabergwall1
1
590
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
Transcript
Web Security Racterub @ ITAC
•元智大學 電通英專大二 •常用 ID:Racterub / Racter •2017-2019 AIS3 學員 •2019
台灣好厲駭 學員 •2020 ⺠生物聯網漏洞挖掘競賽 第二期第三名 •2020 Zyxel 榮耀資戰 第三名 About Me
• 資訊洩露 • Basic PHP • XSS ፓ袅
資訊洩露
• 在現實生活中非常常見 • robots.txt • Git / SVN • HTML
虻懱丽襷
Robots.txt
• 搜尋引擎會依照網站上的 robots.txt 來決定有哪些網頁是 不能檢索的 • 有些時候可以找到一些奇怪的檔案或是目錄 Robots.txt
Robots.txt
Robots.txt
Git / SVN
Git / SVN
• 版本控制。 • 對每一次的檔案修改做紀錄。 • 具有回溯的功能。 • 可以將程式傳上網路,也可以從網路上複製一份 Git /
SVN
• 對於企業來說,可以更好控制程式的製作進度 • 對於網站來說,可以直接部署網站 Git / SVN
• 在線上部署的時候容易忘記砍掉 • 可以直接還原出專案 • 工具 • https://github.com/denny0223/scrabble • https://github.com/lijiejie/GitHack
• https://github.com/WangYihang/GitHacker (個人偏 好這個) Git / SVN
Git / SVN
HTML HyperText Markdown Language
• 資工的 Web 程式設計會學到 HTML
• 資工的 Web 程式設計會學到 • 有時候在 HTML 原始碼裡面會有一些意想不到的東⻄ HTML
• 資工的 Web 程式設計會學到 • 有時候在 HTML 原始碼裡面會有一些意想不到的東⻄ • 註解
• 被引用的 JavaScript HTML
• 掃 Port • nmap, massscan • 掃資料夾或是檔名 • dirsearch,
dirbuster • 掃子域名 • sublist3r ٌ犢
Lab Web2 Information leak
Basic PHP
• 主要是網頁開發的語言 • 有很多奇葩的特性 Basic PHP
• 變數 • 名字前面都會需要加一個 $ • HTTP GET / POST
• $_GET • $_POST • 其他我覺得跟 C / C++ 沒有太大差別 Basic PHP
• GET / POST data • ?a[]=1&a[]=2&a[]=3 Basic PHP
• GET / POST data • ?a[]=1&a[]=2&a[]=3 • a =
Array(1,2,3) Basic PHP
Lab Web2 Basic PHP
• ୧ࣳ獨 • '87' == 87 ? Basic PHP
• ୧ࣳ獨 • '87' == 87 ? • True •
'1e5' == 100e3 ? Basic PHP
• ୧ࣳ獨 • '87' == 87 ? • True •
'1e5' == 100e3 ? • True • NULL == 0 == False ? Basic PHP
• ୧ࣳ獨 • '87' == 87 ? • True •
'1e5' == 100e3 ? • True • NULL == 0 == False ? • True Basic PHP
• ୧ࣳ獨 • '123' + '456' ? Basic PHP
• ୧ࣳ獨 • '123' + '456' ? • '579' •
'123' . '456'牫 Basic PHP
• ୧ࣳ獨 • '123' + '456' ? • '579' •
'123' . '456'牫 • '123456' Basic PHP
Basic PHP
Basic PHP
Basic PHP
• Example: Basic PHP <?php if ($a != $b) {
if (md5($a) == md5($b)){ echo $flag; } }
• Example: Basic PHP <?php if ($a != $b) {
if (md5($a) == md5($b)){ echo $flag; } } $a = QNKCDZO $b = s878926199a
• Example: Basic PHP <?php if ($a != $b) {
if (md5($a) == md5($b)){ echo $flag; } } $a = QNKCDZO $b = s878926199a md5() 0e830400451993494058024219903391 0e545993274517709034328855841020
Basic PHP
啊現在的 PHP 都會改 用 === 跟 !== 了啊
但是 PHP 還有一個潮 潮的酷東東
• md5([]) Array !
• md5([]) • NULL • strcmp([], []) Array !
• md5([]) • NULL • strcmp([], []) • NULL •
sha1([]) Array !
• md5([]) • NULL • strcmp([], []) • NULL •
sha1([]) • NULL Array !
• Example: Array ! <?php if ($a !== $b) {
if (md5($a) === md5($b)){ echo $flag; } } $a = [1] $b = [2]
• Example: Array ! <?php if ($a !== $b) {
if (md5($a) === md5($b)){ echo $flag; } } $a = [1] $b = [2] md5() NULL NULL
Array !
Array !
Array ! ̖ https://dev.to/2dsharp/php-sucks-can-it-suck-less-1mjb
Lab Web2 PHP sucks
XSS Cross-Site Scripting
• 在使用者的頁面上面執行惡意的 JavaScript XSS
• 在使用者的頁面上面執行惡意的 JavaScript • Ԇᥝฎ猂 cookie XSS
XSS <?php if (!empty($_GET['input'])){ echo $_GET['input']; }
• 玱疤ࣳ • 疥֦ጱ䘣纷ୗ嘨蝑ک Server 牧㪔Ӭኧ Server 薹ຉ • 㱪ਂࣳ
• ֦ጱ䘣纷ୗ嘨ᤩ㱪ਂࣁ Server • DOM XSS • ፗ矑ኧਮ䜛ᒒ藉咳 XSS 圵觊
• HTML 可以執行 JavaScript 的是 <script> XSS ᴠ纠牫
• HTML 可以執行 JavaScript 的是 <script> • 那不就過濾掉 <script>!"script> 就好ㄌ
XSS ᴠ纠牫
• HTML 可以執行 JavaScript 的是 <script> • 那不就過濾掉 <script>!"script> 就好ㄌ
XSS ᴠ纠牫
• <svg/onload=alert()> • <img src=@ onerror=alert()> • <a href=@ onclick=alert()>
• <body onload=alert()> XSS !
作業 Web2 Infoleak
作業 Web2 Make PHP Great Again!
最後 有意願打 CTF 的可以私下 來找我ㄛ