---
# System prepended metadata

title: Write-up for Program Misuse

---


**Write-up for** [Program Misuse](https://pwn.college/cse466-f2022/program-misuse)
---

`Processing: solved: 26 levels, writeup: 6 levels
`

**Level 1: Cat**
---

```
Welcome to /challenge/babysuid_level1!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/cat.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level1) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/cat!
```

* Nghĩ đơn giản về lệnh cat là đọc nội dung file -> cat luôn file /flag để lấy flag

![image.png](https://hackmd.io/_uploads/S1Zw9-GmT.png)

**Level 2: More**
---

```
Welcome to /challenge/babysuid_level2!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/more.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level2) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/more!
```

* Ở level này sẽ dùng đến lệnh more
    * Cat sẽ đọc toàn bộ file, more sẽ chỉ đọc 1 phần của file nhưng số dòng lớn, enter để đọc thêm

![image.png](https://hackmd.io/_uploads/Sy4Oj-GQ6.png)

**Level 3: Less**
---

```
Welcome to /challenge/babysuid_level3!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/less.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level3) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/less!
```

* Ngược với more là less
    * Less công dụng cũng giống như more, đọc 1 phần nội dung của file, nhưng chỉ đọc 1 phần nhỏ

![image.png](https://hackmd.io/_uploads/r1vl3ZM7p.png)
![image.png](https://hackmd.io/_uploads/BkMk2WfXa.png)

**Level 4: Tail**
---

```
Welcome to /challenge/babysuid_level4!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/tail.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level4) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/tail!
```

* Như lệnh, tail sẽ đọc nội dung phần cuối của file, mặc định sẽ là 10 dòng, có thể đọc với giới hạn byte và số dòng trong options

![image.png](https://hackmd.io/_uploads/S1KUnWM7a.png)

**Level 5: Head**
---

```
Welcome to /challenge/babysuid_level5!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/head.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level5) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/head!
```

* Ngược lại với tail, head sẽ đọc phần đầu của file, mặc định là 10 dòng và cũng có thể tùy biến như tail

![image.png](https://hackmd.io/_uploads/rk5GpZGma.png)

**Level 6: Sort**
---

```
Welcome to /challenge/babysuid_level6!

This challenge is part of a series of programs that
exposes you to very simple programs that let you directly read the flag.

I just set the SUID bit on /usr/bin/sort.
Try to use it to read the flag!

IMPORTANT: make sure to run me (/challenge/babysuid_level6) every time that you restart
this challenge container to make sure that I set the SUID bit on /usr/bin/sort!
```

* Như tên lệnh, sort sẽ sắp xếp nội dung của file theo hàng và in ra, mặc định sẽ là sắp xếp tăng dần dựa theo kí tự đầu tiên của hàng, có nhiều options trong đó có -reverse

![image.png](https://hackmd.io/_uploads/BJ1xkGMQT.png)

**Level 7: 