{"answers":{"affected":"2 open source packages ship an affected version, including @budibase/server.","exploited":"There is no known exploitation of GHSA-4g2x-vq5p-5vj6 in the wild and no public exploit code.","fix":"Upgrade @budibase/server to 2.20.0 or later.","what":"GHSA-4g2x-vq5p-5vj6 is a code injection vulnerability in @budibase/server, published on 1 Mar 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-4g2x-vq5p-5vj6 and fix it if it is affected.\n\nWhat it is: GHSA-4g2x-vq5p-5vj6 is a code injection vulnerability in @budibase/server, published on 1 Mar 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-4g2x-vq5p-5vj6 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @budibase/server (npm): affected all versions; fixed in 2.20.0\n- @budibase/server (npm): affected all versions; fixed in 2.20.0\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-4g2x-vq5p-5vj6/ (Markdown: https://insights.sbomify.com/GHSA-4g2x-vq5p-5vj6/index.md)","id":"GHSA-4g2x-vq5p-5vj6","markdown":"https://insights.sbomify.com/GHSA-4g2x-vq5p-5vj6/index.md","name":"GHSA-4g2x-vq5p-5vj6","record":{"aliases":[],"analysis":{"component_type":"web_application","fix_type":"upgrade","impacts":["code_execution","data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"Budibase low-code platform","requires_auth":"low_privilege","summary":"Attackers can escape the vm2 sandbox to execute arbitrary code and read server environment variables via crafted formulas.","user_interaction":"required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Impact\nPreviously, budibase used a library called `vm2` for code execution inside the Budibase builder and apps, such as the UI below for configuring bindings in the design section.\n\n![Screenshot 2024-03-01 at 13 50 16](https://github.com/Budibase/budibase/assets/11256663/5f049b64-cd99-48fd-a184-644cd312c82e)\n\nDue to a [vulnerability in vm2](https://github.com/advisories/GHSA-cchq-frgv-rjh5), any environment that executed the code server side (automations and column formulas) was susceptible to this vulnerability, allowing users to escape the sandbox provided by `vm2`, and to expose server side variables such as `process.env`. It's recommended by the authors of `vm2` themselves that you should move to another solution for remote JS execution due to this vulnerability.\n\n### Patches\nWe moved our entire JS sandbox infrastructure over to `isolated-vm`, a much more secure and recommended library for remote code execution in 2.20.0. This also comes with a performance benefit in the way we cache and execute your JS server side. The budibase cloud platform has been patched already and is not running `vm2`, but self host users will need to manage the updates by themselves.\n\nIf you are a self hosted user, you can take the following steps to reproduce the exploit and to verify if your installation is currently affected.\n\nCreate a new formula column on one of your tables in the data section with the following configuration.\n![Screenshot 2024-03-01 at 14 04 28](https://github.com/Budibase/budibase/assets/11256663/0f8bc19b-9e44-4e95-ab4e-6ef6278eea34)\n\nAdd the following JS function to the formula and save.\n![Screenshot 2024-03-01 at 14 05 19](https://github.com/Budibase/budibase/assets/11256663/1d0c9705-1a88-49b0-93e0-f385a04b5c25)\n\nIf your installation is vulnerable, when the formula evaluates you will be able to see the printed `process.env` in your new formula field. If not, your installation is not affected.\n\n### Workarounds\nThere is no workaround at this time for any budibase app that uses JS. You must fully migrate post version 2.20.0 to patch the vulnerability.\n\n### References\n- https://github.com/advisories/GHSA-cchq-frgv-rjh5","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Budibase affected by VM2 Constructor Escape Vulnerability","id":"GHSA-4g2x-vq5p-5vj6","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"code_injection","year":"2024"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["2.20.0"],"introduced":["0"],"last_affected":[],"package":"@budibase/server","purl":null,"source":"GHSA-4g2x-vq5p-5vj6"},{"ecosystem":"npm","fixed":["2.20.0"],"introduced":["0"],"last_affected":[],"package":"@budibase/server","purl":"pkg:npm/%40budibase/server","source":"GHSA-4g2x-vq5p-5vj6"}],"products":null,"published":"2024-03-01","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can escape the vm2 sandbox to execute arbitrary code and read server environment variables via crafted formulas.","url":"https://insights.sbomify.com/GHSA-4g2x-vq5p-5vj6/"}