Skip to content

Commit 4cec129

Browse files
committed
Responded to comments
1 parent ddb29d6 commit 4cec129

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

documentation/modules/exploit/multi/http/pgadmin_query_tool_authenticated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ docker run -d -p 8484:80 -e [email protected] -e PGADMIN_DEF
1919
```
2020
A PostgreSQL database needs to be connected to the pgAdmin instance in order to exploit. The version of postgresql doesn't matter:
2121
```bash
22-
docker run -d \\n -p 5432:5432 \\n --name postgres \\n -e POSTGRES_PASSWORD=mysecretpassword \\n -e POSTGRES_USER=pgadminuser \\n -e POSTGRES_DB=pgadmin \\n postgres:latest
22+
docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=pgadminuser -e POSTGRES_DB=pgadmin postgres:latest
2323
```
2424

2525
## Verification Steps

lib/msf/core/exploit/pgadmin.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ def get_version
2424
Rex::Version.new("#{Regexp.last_match(1).to_i}.#{Regexp.last_match(2).to_i}.#{Regexp.last_match(3).to_i}")
2525
end
2626

27-
def check_version(patched_version)
27+
def check_version(patched_version, low_bound = 0)
2828
version = get_version
2929
return Msf::Exploit::CheckCode::Unknown('Unable to determine the target version') unless version
30-
return Msf::Exploit::CheckCode::Safe("pgAdmin version #{version} is not affected") if version >= Rex::Version.new(patched_version)
30+
return Msf::Exploit::CheckCode::Safe("pgAdmin version #{version} is not affected") if version >= Rex::Version.new(patched_version) || version < Rex::Version.new(low_bound)
3131

3232
Msf::Exploit::CheckCode::Appears("pgAdmin version #{version} is affected")
3333
end
@@ -37,7 +37,7 @@ def csrf_token
3737

3838
res = send_request_cgi('uri' => normalize_uri(target_uri.path, 'login'), 'keep_cookies' => true)
3939
set_csrf_token_from_login_page(res)
40-
fail_with(Failure::UnexpectedReply, 'Failed to obtain the CSRF token') unless @csrf_token
40+
fail_with(Msf::Exploit::Failure::UnexpectedReply, 'Failed to obtain the CSRF token') unless @csrf_token
4141
@csrf_token
4242
end
4343

modules/exploits/multi/http/pgadmin_query_tool_authenticated.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def initialize(info = {})
6868
end
6969

7070
def check
71-
check_version('9.2')
71+
# Although there is no low bound mentioned in the advisory, we can see that the vulnerable eval() statement was
72+
# introduced in version 8.10: https://github.com/pgadmin-org/pgadmin4/commit/22cdb86aab5825787a36d149f8e6eb34fb26d817
73+
check_version('9.2', '8.10')
7274
end
7375

7476
# Return only the required URI encoded fields in order for the POST request to be successful

0 commit comments

Comments
 (0)