Skip to content
DoS Disclosed report Intermediate CVE-2020-8123

Denial Of Service in Strapi Framework using argument injection

The admin panel's plugin install and uninstall handlers validated user input with a regex that allowed the hyphen character, so an attacker could pass command-line flags such as help or version instead of a plugin name. This caused the server to restart each time the request was sent, resulting in a denial of service.

PRince CHaddha Follow

Originally disclosed on HackerOne

  • Triaged in 19 hours
  • Fixed in 22 days
  • Disclosed after 23 days

I would like to report Denial Of Service in Strapi Framework.It allows attacker to force restart the server using argument injection.

Module

module name: strapi version: 3.0.0-beta.18.3 and earlier npm page: https://www.npmjs.com/package/strapi

Module Description

The Strapi HTTP layer sits on top of Koa. Its ensemble of small modules work together to provide simplicity, maintainability, and structural conventions to Node.js applications.

Module Stats

[1] weekly downloads 8,508

Vulnerability

Vulnerability Description

While reviewing source code i found that "installPlugin" and "uninstallPlugin" handler functions for the admin panel (https://github.com/strapi/strapi/blob/master/packages/strapi-admin/controllers/Admin.js) is using regex on line 70 & 110 i.e /^[A-Za-z0-9_-]+$/ before passing user input to execa() on line 77 & 117 to prevent command injection but the regex allows - character.Using this attacker can pass valid arguments like "-h" "-v" "--help" which will add after the command npm run strapi -- install <user-input> & npm run strapi -- uninstall <user-input> and leads the serve to restart.

Steps To Reproduce:

Create a new strapi project and start the server by using yarn. Login to admin panel by visiting http://172.16.129.155:1337/admin/ Goto http://172.16.129.155:1337/admin/marketplace & click on download while intercepting the request. Change value of plugin to "-h", "--help", "-v" or "--version" Check console the server will restart everytime we send the request using valid strapi arguments.

Patch

Instead of strapi.reload(); after executing the command there should be a check to validate if a valid plugin is installed or uninstalled.Many user uses _ & - in plugin names so blacklisting the above 4 inputs will fix this issue instead of removing _ & - from the regex

Wrap up

Select Y or N for the following statements:

  • I contacted the maintainer to let them know: [Y/N] N
  • I opened an issue in the related repository: [Y/N] N

#####Also, It looks like an intented behaviour to restart server after uninstalling or installing a valid plugin but by just passing the valid arguments we can restart the server.

Impact

Attacker can cause the server to restart even without installing or uninstalling a valid plugin.

The original report as published on HackerOne, by princechaddha. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the input validation regex permitted the hyphen character, allowing command-line flags to be injected into the execa call that runs the plugin install or uninstall command.

Impact

An attacker could cause the server to restart repeatedly, disrupting availability, even without installing or uninstalling a valid plugin.

What the attacker needed

Access to the admin panel; ability to intercept requests

The fix

The report suggests adding a check that a valid plugin was actually installed or uninstalled before reloading, and blacklisting the specific flag inputs rather than removing the hyphen from the regex.

How it was found

  1. Create a new Strapi project and start the server with yarn.
  2. Log in to the admin panel.
  3. Go to the marketplace page and click download while intercepting the request.
  4. Change the plugin value to a command-line flag such as help or version.
  5. Send the request and observe the server restart in the console.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The admin panel installs or removes plugins by name. The code checked the name with a pattern that allowed a dash, so someone could send something that looks like a command option rather than a plugin name. The server then ran the plugin command with that option, and the command made the server restart, so the site went down for a moment.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.