# Persistencia en Linux

1. <mark style="color:green;">**Crontab**</mark> Los atacantes pueden agregar entradas maliciosas al crontab para ejecutar su payload a intervalos regulares.
   * <mark style="color:green;">**crontab**</mark><mark style="color:green;">:</mark>

     ```bash
     (crontab -l ; echo "*/5 * * * * /ruta/maliciosa.sh") | crontab -
     ```
2. <mark style="color:green;">**Scripts de Inicio**</mark> Modificar scripts de inicio del sistema para incluir el payload malicioso.
   * <mark style="color:green;">**/etc/rc.local**</mark><mark style="color:green;">:</mark>

     ```bash
     echo "/ruta/maliciosa.sh" >> /etc/rc.local
     ```
3. <mark style="color:green;">**Alias de Comandos**</mark> Crear alias para comandos comunes que ejecuten el payload malicioso antes de ejecutar el comando original.
   * <mark style="color:green;">**\~/.bashrc**</mark><mark style="color:green;">:</mark>

     ```bash
     alias ls='ls --color=auto; /ruta/maliciosa.sh'
     ```
4. <mark style="color:green;">**LD\_PRELOAD**</mark> Utilizar la variable de entorno `LD_PRELOAD` para cargar una biblioteca maliciosa antes de cualquier otra biblioteca compartida.
   * <mark style="color:green;">**\~/.bashrc**</mark><mark style="color:green;">:</mark>

     ```bash
     export LD_PRELOAD=/ruta/maliciosa.so
     ```


---

# 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://books.spartan-cybersec.com/cppj/tecnicas-de-persistencia/persistencia-en-linux.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.
