# picoCTF_2023 ## 1. findme ![image](https://user-images.githubusercontent.com/94095722/225293933-c78ad2a7-d6b6-409c-b9f4-c1818ffdcac9.png) Ta thử đăng nhập vô với username và password đã cho sẵn (username = `test`, password = `test`) ![image](https://user-images.githubusercontent.com/94095722/225294525-d77c584d-9a12-4989-a7ae-2a5c412f98a8.png) Và bùm, **1 cú lừa**. Ở đây nhìn kỹ thì mới thấy là username = `test`, password = `test!` ![image](https://user-images.githubusercontent.com/94095722/225301033-43373d5b-0b17-4374-8e04-1afadfa29c85.png) Sau khi đăng nhập thành công và loay hay một hồi ở đây thì nhận ra rằng **ở đây chả có cái vẹo gì cả** Bật burpsuite lên kiểm tra thử: Chặn chỗ login xem có gì không ![image](https://user-images.githubusercontent.com/94095722/225301863-f198bccb-3dd7-4a6a-8109-1937de5e8f05.png) Thấy cái dòng `cGljb0NURntwcm94aWVzX2Fs` khả nghi quá đem ra decode base64 thử xem => `picoCTF{proxies_al` Ra mảnh đầu của flag rồi giờ tìm mảnh cuối. Ta tiếp tục điều hướng sang trang sau khi login thành công ![image](https://user-images.githubusercontent.com/94095722/225302621-400c8af1-a6cd-4ab2-b45e-fb89a2e4b2ba.png) Cái dòng `bF90aGVfd2F5XzU5OWE4MGMyfQ==` vừa lạ vừa quen, lại tiếp tục decode base64 => `l_the_way_599a80c2}` Vậy ghép lại ra flag: `picoCTF{proxies_all_the_way_599a80c2}` ## 2. MatchTheRegex ![image](https://user-images.githubusercontent.com/94095722/225548877-d4b54a05-3f4e-4582-8447-b1fb012c5e25.png) Như tên đề bài, ta phải nhập giá trị khớp với giá trị nào đó thì nó sẽ trả về flag Thử kiểm tra source code xem ![image](https://user-images.githubusercontent.com/94095722/225549441-886ac85f-3c72-4ea0-8d5b-3b383ec19cc2.png) Biến `val` này sẽ nhận giá trị của ô **input**. Sau đó `fetch` sẽ call Api trả về flag dưới dạng JSON nếu như biến `val` match Để ý thì ở đây có comment 1 dòng `// ^p.....F!?` => Chắc là `picoCTF` đây mà :)) Nhập thử `picoCTF` vào ô input ![image](https://user-images.githubusercontent.com/94095722/225550364-9c1981b4-39f2-46e6-9b22-8b4b7095aaa4.png) Và bùm ta được flag Hoặc là truy cập vào `/flag?input=${val}` thay giá trị biến `val` = `picoCTF` ![image](https://user-images.githubusercontent.com/94095722/225553625-5eed835b-ec91-4c28-b784-2236d5df6149.png) Ta cũng thu được flag dưới dạng JSON => Flag: `picoCTF{succ3ssfully_matchtheregex_2375af79}` ## 3. SOAP ![image](https://user-images.githubusercontent.com/94095722/225556170-f73d9221-f310-4595-9981-c10546eda275.png) Mới vô thì không thấy gì đặc biệt cả. Thử dùng burp suite xem sao ![image](https://user-images.githubusercontent.com/94095722/225556762-7bd467e1-a090-447c-b437-a98f6db58838.png) Dễ dàng nhận ra đây là `XXE` Sau một hồi viết lách ![image](https://user-images.githubusercontent.com/94095722/225558724-30e135f4-b783-4598-b184-d60654155438.png) ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE change-log [<!ENTITY xxe SYSTEM "file:///etc/passwd">]> <data> <ID> &xxe; </ID> </data> ``` => flag: `picoCTF{XML_3xtern@l_3nt1t1ty_0dcf926e}` ## 4. More SQLi ![image](https://user-images.githubusercontent.com/94095722/225562095-104905ec-6ff6-4a5c-94ce-929b30385ce8.png) Mới đầu vô thử login bằng username = `admin`, password = `admin` ![image](https://user-images.githubusercontent.com/94095722/225562298-e039f292-3639-491f-b5e6-07cac75943e3.png) Khả năng cao là bị dính SQL injection Thừ dùng username = `admin' or 1=1-- `, password = `admin' or 1=1-- ` ![image](https://user-images.githubusercontent.com/94095722/225562628-fafbaf12-a136-4d05-b495-244dd9e3a8cc.png) Login thành công ^^ Ta thử check tiếp xem có bị dinh Sql injection hay không Bằng cách nhập `1' or '1'='1'-- ` vô ô input ![image](https://user-images.githubusercontent.com/94095722/225564076-0f740c67-b8f7-4122-a06a-a3571c02452a.png) => Dính Sqli rồi ^^ Giờ ta sẽ tìm số cột bị lỗi, lấy đại 1 tên công ty để viết query (`Bamako`) query: `Bamako' order by 3-- ` ![image](https://user-images.githubusercontent.com/94095722/225564683-cd642830-cb39-46ee-bb9e-c10ec211f592.png) 3 cột đầu vẫn chưa có dấu hiệu gì, tăng lên 4 xem sao query: `Bamako' order by 4-- ` ![image](https://user-images.githubusercontent.com/94095722/225564919-6289a587-6be7-44ca-8d3e-f0c9c6afb32a.png) Bùm đến cột thứ 4 không hiện gì thì có nghĩa là 3 cột đầu bị lỗi Tiếp theo là tìm tên các table (vì đây là Sqlite nên sẽ có phần khác 1 chút `table_name` --> `tbl_name`, `information_schema.tables` --> `sqlite_master`) query: `Bamako' union select tbl_name,NULL,NULL from sqlite_master-- ` ![image](https://user-images.githubusercontent.com/94095722/225567222-5929e573-30e7-4e90-9843-a3eade334cae.png) Giờ đến tìm thêm mỗi tabel có những column gì Chợt nhận ra mình có thể tìm luôn tên table kèm column mỗi cái luôn query: `Bamako' union select sql,NULL,NULL from sqlite_master-- ` ![image](https://user-images.githubusercontent.com/94095722/225568049-a8d1130f-d970-4bdd-a2ca-945766ed71ca.png) Thấy flag kia rồi, tiếp theo sẽ tiến hành đọc nó query: `Bamako' union select flag,NULL,NULL from more_table-- ` ![image](https://user-images.githubusercontent.com/94095722/225568700-4ddfe188-cdf4-4cbf-b443-825f1918ef5e.png) => flag: `picoCTF{G3tting_5QL_1nJ3c7I0N_l1k3_y0u_sh0ulD_78d0583a}`