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
ITAC | Websec 2
Search
racterub
October 20, 2020
Programming
220
0
Share
ITAC | Websec 2
ITAC | Websec 2
racterub
October 20, 2020
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
140
ITAC | Websec 3
racterub
0
250
ITAC | Websec 1
racterub
0
250
ITAC | Linux Basics
racterub
0
120
Introducing Reverse Engineering @ YZU CS250
racterub
0
230
ITAC | Jinja & Bootstrap
racterub
1
120
ITAC | Flask - Basic Flask
racterub
1
110
ITAC-Flask | Environment setup
racterub
1
94
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
200
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
760
GitHubCopilotCLIをはじめよう.pdf
htkym
0
320
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
360
空間オーディオの活用
objectiveaudio
0
140
AgentCore Optimizationを始めよう!
licux
3
210
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.5k
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
480
Agentic Elixir
whatyouhide
0
440
Programming with a DJ Controller — not vibe coding
m_seki
3
790
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.5k
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
540
Navigating Weather and Climate Data
rabernat
0
180
Ethics towards AI in product and experience design
skipperchong
2
270
Building an army of robots
kneath
306
46k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
30 Presentation Tips
portentint
PRO
1
290
The Spectacular Lies of Maps
axbom
PRO
1
730
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Writing Fast Ruby
sferik
630
63k
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 的可以私下 來找我ㄛ