這裡是爆肝型工程師,一位很懶的工程師,有事沒事就在寫程式(?
- 做過前端與後端工程師,現在轉職資安工程師
- 喜歡研究新技術、看論文、架設各種服務,偶爾打打CTF
- Read More→
這裡是爆肝型工程師,一位很懶的工程師,有事沒事就在寫程式(?
題目資訊 來源:picoCTF2023 分類:Web Exploitation 難度:中 解題流程 先用題目給的帳號密碼登入 登入後,下面就會有特定身分才能開的書,其中一個就是 flag 因為網頁本身沒有特別的東西 往後看 cookie、local storage 和 session storage local storage 存了兩個值,分別是 auth-token 和 token-payload token 解開就是 payload 的值,如下圖 提示說 role 跟 userId 可能有有趣的東西 直接把 role 改成 Admin,userId 改成 0 會發現使用者名稱換了,然後頭像找不到 如果直接改 token 畫面就沒東西,看來也會驗證簽章 好吧,轉頭找原始碼… 提示說 controllers, services 和 security 值得注意 翻一下有個產生 secret 的片段在 /src/main/java/io/github/nandandesai/pico/security/SecretGenerator.java 所以 secret 就直接是 1234 把 secret 改成 1234 再寫回去 ...
題目資訊 來源:picoCTF2021 分類:Web Exploitation 難度:中 解題流程 探勘 打開網站,會看到一個帳號密碼的登入介面 打開 Filter 則是有以下說明: Filters: or and true false union like = > < ; -- /* */ admin 嘗試破解 由於 admin 不能打,先試試 root 過濾器沒有過濾到 IS 跟 NOT 所以用 a' IS NOT 'b 強制為 true 送出後,會出現完整 SQL 指令,同時也說 not admin 恩…好,看來是有繞過,但一定要 admin 那 admin 就用字串拼接的,由於提示說是 sqlite,就只能用 | 結合字串 Payload: Username: ad'||'min Password: a' IS NOT 'b 登入成功,回到 filter.php,出現 PHP 原始碼,而 FLAG 就在最底下 ...
題目資訊 來源:picoCTF2024 分類:Web Exploitation 難度:中 解題流程 探勘 先解壓題目的檔案,有一些 HTML 跟 JS 在index.html裡,如果登入成功,會印出回傳資料,並寫入 sessionStorge 在server.js裡,有初始使用者的資料會在伺服器啟動時被新增,但密碼可能猜不到 1 2 3 4 5 6 7 // Store initial user const initialUser = new User({ firstName: 'pico', lastName: 'player', email: 'picoplayer355@picoctf.org', password: crypto.randomBytes(16).toString('hex').slice(0, 16), }) 還有一個/admin,但沒有用到可以先不看 然後是/login,email 和 password 這邊沒有檢查輸入安全性,並且會解析成 JSON 物件,應該有洞可以打 最後,flag 可能就存在 token 裡 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 // Handle login form submission with JSON app.post('/login', async (req, res) => { const { email, password } = req.body try { const user = await User.findOne({ email: email.startsWith('{') && email.endsWith('}') ? JSON.parse(email) : email, password: password.startsWith('{') && password.endsWith('}') ? JSON.parse(password) : password, }) if (user) { res.json({ success: true, email: user.email, token: user.token, firstName: user.firstName, lastName: user.lastName, }) } else { res.json({ success: false }) } } catch (err) { res.status(500).json({ success: false, error: err.message }) } }) 解題 先測看看簡單的~ ...
題目資訊 來源:picoCTF2024 分類:Web Exploitation 難度:中 解題流程 探勘 打開網頁,會看到只有按鈕可以上傳圖片 看原始碼也是 POST 到自己 上傳正常圖片只會說上傳成功 嘗試破解 直接寫 WebShell,然後改名成 png 做一個假的 PNG 上傳,內容如下,然後改名成 webshell.png.php <?php if(isset($_GET['cmd'])) { system($_GET['cmd']); } ?> 出現錯誤: Error: The file is not a valid PNG image: 3c3f7068 看來會檢查 Magic Number 繼續探勘 robots.txt User-agent: * Disallow: /instructions.txt Disallow: /uploads/ instructions.txt Let's create a web app for PNG Images processing. It needs to: Allow users to upload PNG images look for ".png" extension in the submitted files make sure the magic bytes match (not sure what this is exactly but wikipedia says that the first few bytes contain 'PNG' in hexadecimal: "50 4E 47" ) after validation, store the uploaded files so that the admin can retrieve them later and do the necessary processing. 看起來確實有要求以 png 作為副檔名,會驗證檔案開頭是否為 PNG(50 4E 47) ...
題目資訊 來源:picoCTF2024 分類:Web Exploitation 難度:中 解題流程 探勘 打開網頁,是個登入介面 題目已經說是 SQL Injection,先隨便輸入假資料後,會回傳內部的 SQL 語法 這是典型的 SQL Injection 題目,擋掉 password 就能直接登入 ' OR '1'='1 登入成功!但沒東西?!按一下 F12 Flag picoCTF{L00k5_l1k3_y0u_solv3d_it_9b0a4e21}