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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
racterub
October 20, 2020
Programming
280
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
Transcript
65 slides
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 的可以私下 來找我ㄛ
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
190
ITAC | Websec 3
racterub
0
260
ITAC | Websec 1
racterub
0
310
ITAC | Linux Basics
racterub
0
170
Introducing Reverse Engineering @ YZU CS250
racterub
0
250
ITAC | Jinja & Bootstrap
racterub
1
170
ITAC | Flask - Basic Flask
racterub
1
120
ITAC-Flask | Environment setup
racterub
1
140
Other Decks in Programming
See All in Programming
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
260
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
290
オーケストレーション記述言語 Katari
yukikurage
0
270
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
130
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
はじめてのPLATEAU
nokonoko1203
1
660
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
140
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
110
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
140
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
420
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.3k
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
529
40k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
Chasing Engaging Ingredients in Design
codingconduct
0
400
Site-Speed That Sticks
csswizardry
13
1.6k
What's in a price? How to price your products and services
michaelherold
247
13k
A designer walks into a library…
pauljervisheath
211
25k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
530