:::info # PWN 講師:貝坦betan 時間:8/28 10:00~12:00 課程簡報:[簡報](https://docs.google.com/presentation/d/1ta2Tp-9QyoRKHWEenOwPDFgZXe2Ah_G0kfZvVgSevd4/edit?usp=drivesdk) ::: ## outline - pwn - pwn2own 簡介 - labs ## Why CTF - 知己知彼 - 審核自己 - 休閒 - ==$$== - **訓練通靈能力** ## pwn 簡介 - 對 binary 漏洞利用 - 特定輸入造成崩潰 - 程式邏輯漏洞 - buffer overflow - own $\Rightarrow$ pwn - get (reverse?) shell - shell code ## Why pwn? - 比賽 - CTF - Pwn2Own - 學習漏洞 - Blue team - Red team - ==**$$**== ## 流程 - 訊息蒐集 - 固體分析(系統、邏輯...etc.) - 漏洞挖掘 - 漏洞利用(回報是好駭客) - 後門植入  ### 訊息蒐集 其實都會被 HI? - RCE, Remoted Code Execution - CVE, Common vulnerability Exploit - format: `CVE-yyyy-nnnn` - https://www.exploit-db.com/ - https://www.cvedetails.com/ ## pwn 印表機 > - [DEVCORE: Your printer is not your printer ! - Hacking Printers at Pwn2Own Part I](https://devco.re/blog/2023/10/05/your-printer-is-not-your-printer-hacking-printers-pwn2own-part1/) 印表機很常用,但常被忽略。 ### 固體分析 >[!Note] >firmware 韌體,控制硬體 下載舊版的 firmware。 透過分析 URL 可以從網站拿到一些資料。  firmware 有被加密  解密後的 firmware  image base address,通常預設 `0x400000`,是放程式的地址。可以用 [rbasefind](https://github.com/sgayou/rbasefind) 來找。  原本應該要是 string 的地方不是 string $\rightarrow$ 地址有發生偏移。最後用一些函式名稱比對的方式調整偏移量(offset),得出 image base 是 `0x40affde0`。 ### 漏洞挖掘 分析是否有保護 - No Stack Guard 防止不合理的輸入攻擊 - No DEP 防止非法存取記憶體片段 - No ASLR 防止攻擊者精準定位系統或漏洞記憶體位置 $\Rightarrow$ hack friendly - BJNP,Canon 的通訊協定 - SLP, Service Location Protocol,裝置的通訊協定 ## Lab1 沒有檢查輸入數量,可以買負數的,會負負得正。 ### Avoid 加 if 判斷輸入數量是否為負。 ## Lab 2 Integer overflow int: `2147483647`~`-2147483648` 3bits: `0b000`(0) - `0b1` = `0b111`(-1) `0b111`(-1) - `0b1` = `0b110`(-2) `0b110`(-2) - `0b1` = `0b101`(-3) `0b101`(-3) - `0b1` = `0b100`(-4) `0b100`(-4) - `0b1` = `0b011`(3) `0b011`(3) - `0b1` = `0b010`(2) `0b010`(3) - `0b1` = `0b001`(1) `0b001`(3) - `0b1` = `0b000`(0) 回到第一個 input: `(2^31 - 500)/50` = `42949662` ## Lab 3 覆蓋資料 ### avoid `strncpy` ## Buffer overflow 覆蓋地址
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up