Skip to content
RCE Disclosed report Beginner CVE-2020-8149

[logkitty] RCE via insecure command formatting

The logkitty command-line tool builds a shell command by inserting a user-supplied app name without sanitising it, so shell metacharacters in that name are interpreted by the shell. An attacker who can influence the argument could run arbitrary commands on the machine running logkitty.

mik317 Follow

Originally disclosed on HackerOne

High 7.8 View original
  • Triaged in 26 hours
  • Fixed in 19 days
  • Disclosed after 49 days

I would like to report a RCE issue in the logkitty module. It allows to execute arbitrary commands remotely inside the victim's PC

Module

module name: logkitty version: 0.7.0 npm page: https://www.npmjs.com/package/logkitty

Module Description

Display pretty Android and iOS logs without Android Studio or Console.app, with intuitive Command Line Interface.

Module Stats

[170,222] downloads in the last week

Vulnerability Description

The issue occurs because a user input is formatted inside a command that will be executed without any check. The issue arises here: https://github.com/zamotany/logkitty/blob/master/src/android/adb.ts#L55

Steps To Reproduce:

  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
Bash
npm i logkitty # Install affected module
logkitty android app 'test; touch HACKED' #  Note the *touch command* is inside the *'* (single quote), so it's an argument, while it will be executed anyway
  1. Recheck the files: now HACKED has been created :)
    Screenshot_from_2020-03-21_01-46-19.png
    Screenshot_from_2020-03-21_01-46-19.png From the original on HackerOne

Patch

Don't format commands using insecure user's inputs :)

Supporting Material/References:

  • [OPERATING SYSTEM VERSION]: Kali Linux

Wrap up

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

Impact

RCE via command formatting on logkitty

The original report as published on HackerOne, by mik317. 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 app name argument is concatenated into a shell command string and passed to a shell, so shell metacharacters are interpreted rather than treated as literal text.

Impact

An attacker able to supply the app name argument could execute arbitrary commands on the victim's machine, though this requires the victim to run logkitty with attacker-influenced input.

What the attacker needed

Logkitty installed; victim runs logkitty with attacker-controlled app name

How it was found

  1. Confirm no file named HACKED exists in the working directory
  2. Install the affected logkitty module
  3. Run logkitty with an app name containing a shell separator and a file-creating command
  4. Check the directory again and observe the new file

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.

This tool runs a system command to fetch logs, and it pastes whatever name you give it straight into that command. Because the shell treats characters like semicolons as separators, a crafted name can add extra commands that the tool then runs for you. That means someone who controls the name could make your computer run their code.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by mik317

View all

23 more disclosed reports, best first.

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.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.