Vulnerabilities in Python Code

OS Command Injection Vulnerable Example The following snippet contains a Flask web application written in Python that executes the nslookup command to resolve the host supplied by the user. @app.route("/dns") def page(): hostname = request.values.get(hostname) cmd = 'nslookup ' + hostname return subprocess.check_output(cmd, shell=True) We can see the hostname appended to the command and executed on a subshell with the paratmeter shell=true, an attacker could stack another command with ; in the GET parameter to inject other commands for example cat /etc/paswd . ...

July 5, 2022 · 5 min · 998 words · Jesus Lujan

HackTheBox Armageddon

Machine IP : 10.10.10.233 DATE : 24/07/2021 Matriz de la maquina Esta matriz nos muestra las características de explotación de la maquina. Reconocimiento Primero hacemos un escaneo de puertos para saber cuales están abiertos y conocer sus servicios correspondientes. Nmap ┌──(s4yhii㉿kali)-[~] └─$ nmap -p22,80 -sC -sV -n 10.10.10.233 Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-16 05:46 EDT Nmap scan report for 10.10.10.233 Host is up (0.11s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.4 (protocol 2.0) | ssh-hostkey: | 2048 82:c6:bb:c7:02:6a:93:bb:7c:cb:dd:9c:30:93:79:34 (RSA) | 256 3a:ca:95:30:f3:12:d7:ca:45:05:bc:c7:f1:16:bb:fc (ECDSA) |_ 256 7a:d4:b3:68:79:cf:62:8a:7d:5a:61:e7:06:0f:5f:33 (ED25519) 80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/5.4.16) |_http-generator: Drupal 7 (http://drupal.org) | http-robots.txt: 36 disallowed entries (15 shown) | /includes/ /misc/ /modules/ /profiles/ /scripts/ | /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt | /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt |_/LICENSE.txt /MAINTAINERS.txt |_http-server-header: Apache/2.4.6 (CentOS) PHP/5.4.16 |_http-title: Welcome to Armageddon | Armageddon Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 12.12 seconds Como podemos obervar tenemos 2 puertos abiertos, el 80 con el servicio http y el 22 ssh, como vemos cuenta con el archivo robots.txt y otros más interesantes, procederemos a inspeccionar en la web. ...

July 24, 2021 · 4 min · 840 words · Jesus Lujan

HackTheBox Bashed

Machine IP: 10.10.10.68 DATE : 13/06/2021 Reconocimiento Primero hacemos un escaneo de puertos para saber cuales están abiertos y conocer sus servicios correspondientes. Nmap Como vemos solo el puerto 80 está abierto, así que investigaremos en la web para ver si encontramos algo interesante En la web no encontré nada :,c, pero phpbash me da una pista. Como vemos es un frontend normal,pero el nombre php bash es algo sospechoso al parecer no muestra directorios, por eso le hacemos un brute force para enumerar los directorios con gobuster. ...

June 13, 2021 · 3 min · 624 words · Jesus Lujan