CVE-2020-7729: Arbitrary Code Execution in grunt

grunt Updated 02 Oct 2025

Summary

06/05/2021
Yes i
High
7.1

CVE-2020-7729: Arbitrary Code Execution in grunt. Affects grunt versions < 1.3.0. Fixed in 1.3.0. How to fix ↓

Also tracked for

The same CVE-2020-7729 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Grunt is a JavaScript task runner that automates repetitive tasks such as minification, compilation, and unit testing. It is widely used in web development projects to streamline the build process. However, versions of grunt before 1.3.0 are vulnerable to Arbitrary Code Execution. This vulnerability stems from the default usage of the function load() instead of its secure replacement safeLoad() of the package js-yaml inside grunt.file.readYAML.

Vulnerability Detail

The vulnerability allows an attacker to execute arbitrary code due to the insecure usage of the load() function in grunt. By exploiting this vulnerability, an attacker can inject malicious YAML code into a file that is read by grunt, leading to the execution of arbitrary commands on the system. This can result in unauthorized access, data breaches, and potential compromise of the entire system.

How To Fix

Latest published version: 1.6.3 as of 23 Oct 2026

npm install grunt@1.6.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.3.0

This is the first release that contains the fix.

npm install grunt@1.3.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can manually replace the load() function with safeLoad() in the affected code. Here is an example of how to apply the workaround:

const yaml = require('js-yaml');
const fs = require('fs');

const data = fs.readFileSync('file.yaml', 'utf8');
const parsedData = yaml.safeLoad(data);

Conclusion

The vulnerability in grunt before version 1.3.0 allows for arbitrary code execution, which can have severe consequences for the security of the system. It is crucial to update the grunt package to the latest version and apply the recommended fix to mitigate this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for grunt →

Share this vulnerability

FAQ

This vulnerability allows an attacker to execute arbitrary code on the system, potentially leading to unauthorized access, data breaches, and compromise of the entire system.

Versions of grunt before 1.3.0 are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and Vulert will provide real-time alerts for open-source vulnerabilities.

Yes, the fix for this vulnerability is to update the grunt package to version 1.3.0 or later and replace the usage of the load() function with safeLoad() from the js-yaml package.

Yes, a temporary workaround is to manually replace the load() function with safeLoad() in the affected code. Please refer to the 'workaround' section for an example.

Related vulnerabilities

Recent vulnerabilities recorded for grunt.

How To Fix

Latest published version: 1.6.3 as of 23 Oct 2026

npm install grunt@1.6.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.3.0

This is the first release that contains the fix.

npm install grunt@1.3.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback