**Task 2** -- **1. What is the correct option for finding files based on group** - Tìm file dựa trên group --> `-group` **2. What is format for finding a file with the user named Francis and with a size of 52 kilobytes in the directory /home/francis** - Áp dụng công thức `find [directory path] -type f -size [size]`. Có địa chỉ là **/home/francis**, **52 kilobytes size** và swor hữu bởi Francis. --> `find /home/francis -type f -user francis -size 52k` **3. SSH as topson using his password topson. Go to the /home/topson/chatlogs directory and type the following: grep -iRl 'keyword'. What is the name of the file that you found using this command?** Nhập `grep -iRl 'keyword'` theo yêu cầu là được ![image](https://hackmd.io/_uploads/H1dPJ-FIbl.png) **4. What are the characters subsequent to the word you found?** Sau khi nhận được file **2019-10-11** ở trên, em dùng `/less 2019-10-11` để mở file xong nhận được 1 đống chữ vô nghĩa, tiếp tục `/keyword` để tìm 'keyword' trong đống đấy và tìm được kí tự đằng sau cần tìm là **ttitor**. ![image](https://hackmd.io/_uploads/rk58zZYI-g.png) **5. Read the file named 'ReadMeIfStuck.txt'. What is the Flag?** Để đọc cần biết địa chỉ của file -> không biết -> tìm `find /home/topson -type f -name ReadMeIfStuck.txt` -->Nhận được địa chỉ là **/home/topson/ReadMeIfStuck.txt** ![image](https://hackmd.io/_uploads/rkrY-1pLZx.png) Để tìm flag1, thực hiện theo gợi ý trong bài --> `find /home/topson -type f -name additionalHINT`. Sau khi có địa chỉ thì mở file để xem tiếp: ![image](https://hackmd.io/_uploads/rk6WcbK8-g.png) Nhận được gợi ý về việc tìm địa chỉ tên **telephone numbers**. Tên địa chỉ có chứa space nên khi mở cần `""` lại --> `find /home/topson -type d -name "telephone numbers"` --> truy cập vào đường dẫn trên và list contents chứa bên trong bằng lệnh `ls` sẽ thấy file **readME.txt**. Mở file **readME.txt** nhận được gợi ý tiếp theo: ![image](https://hackmd.io/_uploads/rkaUoWt8Zg.png) Tiếp tục nhập lệnh `find / -type d -name workflows` --> Có địa chỉ dẫn đến folder 'workflows' thì tiếp tục tùm file có modified date vào 2016-09-12. Vậy cần tìm file từ ngày 2016/09/11 đến 2016/09/13 như sau: ![image](https://hackmd.io/_uploads/r18L1ft8Ze.png) Truy cập vào mở file **'eBQRhHvx'**, tiếp tục nhận nhiều từ vô nghĩa => dùng `/less eBQRhHvx` sau đó `/Flag` để lọc lấy flag. :100: ![image](https://hackmd.io/_uploads/H107MzY8-x.png) *** **Task 3** -- **1. Hypothetically, you find yourself in a directory with many files and want to move all these files to the directory of /home/francis/logs. What is the correct command to do this?** --> Áp dụng công thức ta có: `mv * /home/francis/logs` Cụ thể thì vì move nhiều files nên dùng **'*'** **2. you want to transfer a file from your /home/james/Desktop/ with the name script.py to the remote machine (192.168.10.5) directory of /home/john/scripts using the username of john. What would be the full command to do this?** --> Vẫn chỉ áp dụng theo công thức: `scp /home/james/Desktop/script.py john@192.168.10.5:/home/john/scripts` **3. How would you rename a folder named -logs to -newlogs** --> `mv -- -logs -newlogs` Vì tên file bắt đầu bằng ký tự **-** nên cần thêm `--` để máy phân biệt. **4. How would you copy the file named encryption keys to the directory of /home/john/log** --> `cp "encryption keys" /home/john/log` Tên file có chứa space nên cần đóng ngoặc lại, hoặc có thể dùng `encryption\ keys`. **5. Find a file named readME_hint.txt inside topson's directory and read it. Using the instructions it gives you, get the second flag.** Quay lại mở **ReadMeIfStuck.txt** để lấy hướng dẫn tìm flag2 -> Tìm file **readME_hint.txt** bằng lệnh `find / -type f -name readME_hint.txt` Sau khi nhận địa chỉ, `cd` rồi mở file ![image](https://hackmd.io/_uploads/ByzgVcFUWl.png) Theo gợi ý của bài, chuyển file **-MoveMe.txt** sang folder **-march folder**, dùng lệnh `mv -- -MoveMe.txt -march\ folder` Mở **-march folder** sau đó excute bash file bên trong bằng `./-runME.sh` -> nhận flag: Flag{234@i4s87u5hbn$3} *** **Task 4** -- **1/ Download the hash file attached to this task and attempt to crack the MD5 hash. What is the password?** Em không tải được file vào attackbox nên tạo thủ công 1 file vào luôn :vv - Có **rockyou.txt** là một danh sách các mật khẩu dễ đoán, nhiều người sử dụng (như kiểu 12345, abc123,...). - Vì john không tự tìm file, mà chỉ mở file đúng theo đường dẫn được cung cấp, nên trước hết phải dùng `find` để xác định vị trí của **'rockyou.txt'** với **'hash1.txt'**. - Sau đó crack file hash md5 áp dụng command: `john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt /root/Desktop/hash1.txt` ![image](https://hackmd.io/_uploads/Bys8jnpLWe.png) Nhận được password là **secret123** **2/ What is the hash type stored in the file hashA.txt** Login vào acc Sarah xong tìm xem file hashA.txt nằm ở đâu xong thì `cd` vào để thao tác ![image](https://hackmd.io/_uploads/B1aIyt2LWl.png) Mở file **hashA.txt** nhận được chuỗi **'f9d4049dd6a4dc35d40e5265954b2a46'**. ![image](https://hackmd.io/_uploads/HkrDbgA8-g.png) Dùng `hash-identifier` cho ra **'MD5'** và **'MD4'**. Nhập 'MD5' sai nên đáp án là 'MD4' **3/ Crack hashA.txt using john the ripper, what is the password?** Cần lưu ý **'hashA.txt'** là kiểu MD4 để dùng cho đúng dạng ![image](https://hackmd.io/_uploads/HkgtXxAUbe.png) --> **admin** **4/ What is the hash type stored in the file hashB.txt** Tìm và mở file **hashB.txt** nhận được chuỗi **'b7a875fc1ea228b9061041b7cec4bd3c52ab3ce3'** ![image](https://hackmd.io/_uploads/r1lqUFnUWl.png) Dùng `hash-identifier` nhập vào hash trên cho ra kiểu SHA-1 ![image](https://hackmd.io/_uploads/r1yfCyC8Zg.png) **5/ Find a wordlist with the file extention of '.mnf' and use it to crack the hash with the filename hashC.txt. What is the password?** - Trước hết, tìm tất cả các file có đuôi là **'.mnf'** ![image](https://hackmd.io/_uploads/HJG2GAaI-x.png) - `cat ww.mnf` thì thấy đây là một wordlist , đoán là tổng hợp mật khẩu để crack file **hashC.txt** --> quay lại tìm địa chỉ của **hashC.txt** để áp dụng `john` ![image](https://hackmd.io/_uploads/S1CLVRpI-e.png) - Dùng `hash-identifier` nhận thấy chuỗi hash trong file 'hashC.txt' là kiểu sha-256. Em định crack bằng `john` ngay thì phát hiện là bị lỗi gì đấy không chạy được. Sau khi tìm hiểu thì là do wordlist **'ww.mnf'** chưa được lưu về root để đối chiếu --> `scp 'sarah@10.48.137.91:/home/sarah/system\ AB/db/ww.mnf' /home/phuc/Desktop` - Tạo thêm file 'hashC.txt' trên Desktop xong crack bằng `john`. Đến đây thì phải dùng địa chỉ trên root của các file thay vì địa chỉ vừa tìm được: ![image](https://hackmd.io/_uploads/S1cxaJAL-x.png) **6/ Crack hashB.txt using john the ripper, what is the password?** --> **letmein** *** **Task 5** -- **1/ what is the name of the tool which allows us to decode base64 strings?** --> **base64** **2/ find a file called encoded.txt. What is the special answer?** Tiếp tục đăng nhập từ tài khoản của task4 Tìm địa chỉ file **encoded.txt** --> `find / -type f -name encoded.txt 2>/dev/null` ![image](https://hackmd.io/_uploads/SJKVI3YI-e.png) `cd` vào và `cat encoded.txt | base64 -d > new.txt` để mở file --> file sẽ ra rất nhiều ký tự rác. Lúc này, dùng `less new.txt` rồi `/special` để lọc ![image](https://hackmd.io/_uploads/ry7CE2FI-g.png) Bài cho ta biết câu trả lời nằm trong file **ent.txt** => tìm file **ent.txt** ![image](https://hackmd.io/_uploads/SyHx9nKIbl.png) Sau khi nhận được chuỗi như trên, em dùng web https://crackstation.net/ để crack hash -> đáp án là **john** *** **Task 6** -- **1/ You wish to encrypt a file called history_logs.txt using the AES-128 scheme. What is the full command to do this?** --> `gpg --cipher-algo AES-128 --symmetric history_logs.txt` **2/ What is the command to decrypt the file you just encrypted?** --> `gpg history_logs.txt.gpg` **3/ Find an encrypted file called layer4.txt, its password is bob. Use this to locate the flag. What is the flag?** Tìm file **layer4.txt** theo như bài bằng lệnh `find / -type f -name layer4.txt 2>/dev/null` ![image](https://hackmd.io/_uploads/rJs1WWsIbl.png) Bên trong file là các ký tự đã được mã hóa --> để giải ngược mã dùng lệnh `gpg layer4.txt`, đặt file sau khi giải mã là **decrypted.txt** --> mở file vừa được giải mã nhận được gợi ý về việc tìm **layer3.txt** ![image](https://hackmd.io/_uploads/Sk-PWbsU-l.png) Tìm file **layer3.txt** thực hiện giải mã như file trên, đặt file chứa mã đã giải là **decrypted1** --> mở file và nhận gợi ý tiếp theo: ![image](https://hackmd.io/_uploads/SJuWzbiU-g.png) Tiếp tục thao tác tương tự với file **layer2.txt**, file chứa mã đã giải đặt là **decrypted2**. Mở file này ra lại nhận được một chuỗi base64, decode file bằng lệnh `cat decrypted2 | base64 -d` và nhận gợi ý cuối cùng. ![image](https://hackmd.io/_uploads/SkzAE-jLZx.png) Tiếp tục với file **layer1.txt** và đặt tên file chứa là **decrypted3** --> Mở file và nhận ngay FLag :100: ![image](https://hackmd.io/_uploads/Hke4HWsUWe.png) *** **Task 8** -- **1/ Find a file called employees.sql and read the SQL database. (Sarah and Sameer can log both into mysql using the password: password). Find the flag contained in one of the tables. What is the flag?** ![a3ed55a3-4162-4e2b-9b7a-a7eabe6e34bc](https://hackmd.io/_uploads/HJdmol68Wg.png) Ban đầu em vào xong không thao tác được gì cả :vv Exit ra tìm file bằng lệnh `find / -type f -name "employees.sql" 2>/dev/null` ![image](https://hackmd.io/_uploads/r1Tiil6U-g.png) Với đường dẫn này, log lại vào mysql của sarah bằng lệnh `mysql -u sarah -p` set employees.sql làm source với lệnh `source /home/sarah/serverLx/employees.sql` Nhập `show database;` để xem contents bên trong. ![image](https://hackmd.io/_uploads/BkUM6lpLWl.png) Flag nằm bên trong một trong các tables, thử với **employees**. Nhập lệnh `use employees;` --> `show tables;` ![image](https://hackmd.io/_uploads/BJwHTl68-e.png) Tiếp tục dùng lệnh `describe employees;` để xem cấu trúc bảng. ![image](https://hackmd.io/_uploads/HJoF6eaI-e.png) Nhập `select * from employees;` lướt một lúc sẽ thấy FLag ![image](https://hackmd.io/_uploads/SyDbx-T8be.png)