Skip to content
RCE Write-up Intermediate

OCS Inventory NG v2.7 Remote Command Execution (CVE-2020-14947)

An authenticated user could set the SNMP_MIB_DIRECTORY configuration value without filtering, which was later concatenated into a shell command and executed via shell_exec. This allowed the attacker to run arbitrary commands on the server.

shells.systems

Published on shells.systems

Open Computer and Software Inventory Next Generation is free software that enables users to inventory IT assets. OCS-NG collects information about the hardware and software of networked machines running the OCS client program.

The author, on shells.systems

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

The SNMP_MIB_DIRECTORY configuration value was not sanitised before being concatenated into a shell command passed to shell_exec.

Impact

An authenticated attacker could execute arbitrary commands on the server, leading to full compromise.

What the attacker needed

Valid credentials; access to admin configuration

How it was found

  1. Log in to the OCS Inventory web interface.
  2. Navigate to the admin configuration page and set the SNMP_MIB_DIRECTORY value to a malicious command.
  3. Submit the form to save the configuration.
  4. Visit the SNMP configuration page and trigger the get_mib_oid function by submitting the form with update_snmp.
  5. The malicious command is executed on the server.

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 write-up has not been written yet. The Original tab links to the source.

The application took a setting from the user and put it directly into a command that runs on the server. Because it did not check what the user typed, an attacker could add extra commands that the server would run, giving them control of the machine.

What is RCE?

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

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.