> For the complete documentation index, see [llms.txt](https://thamizhiniyancs.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thamizhiniyancs.gitbook.io/writeups/overthewire/natas/level-8-level-9.md).

# Level 8 - Level 9

```
Username: natas9
Password: Sda6t0vkOPkM8YeOZkAGVhFoaplvlJFd
URL:      http://natas9.natas.labs.overthewire.org
```

This time also an input field with a link to the source code.

<figure><img src="https://1858660820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrGZ5yoqZSj85T6vq2w3c%2Fuploads%2FknpeBdVxuzh4xKB1xK4S%2Fimage.png?alt=media&amp;token=a751c57a-b679-4bf3-88c4-f2d2f174021b" alt=""><figcaption></figcaption></figure>

On checking the source code, input keyword/string that we give is directly supplied as a parameter to the grep command, which looks out for matching strings in the `dictionary.txt` file and returns the output.

<figure><img src="https://1858660820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrGZ5yoqZSj85T6vq2w3c%2Fuploads%2FYFY6sguyN5PLYbALjL4A%2Fimage.png?alt=media&amp;token=b6a653d8-14af-41f0-9285-e2f17a320bc2" alt=""><figcaption></figcaption></figure>

This logic is vulnerable to [Command Injection](https://owasp.org/www-community/attacks/Command_Injection#:~:text=Command%20injection%20is%20an%20attack,.\)%20to%20a%20system%20shell.), since the input is directly substituted in the command and no input sanitization is performed.

So, I tried to get the password for the next level by using the following input value:

`; cat /etc/natas_webpass/natas10 ;`

Direct link to the solution:

<http://natas9.natas.labs.overthewire.org/?needle=%3B+cat+%2Fetc%2Fnatas_webpass%2Fnatas10+%3B&submit=Search>

<figure><img src="https://1858660820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrGZ5yoqZSj85T6vq2w3c%2Fuploads%2F14SMvWOmv24ocOSlXKes%2Fimage.png?alt=media&amp;token=a113bb1d-1dbd-49a9-a1dc-c2efc2f3a141" alt=""><figcaption></figcaption></figure>
