Skip to content

Instantly share code, notes, and snippets.

@wilpig
Created November 4, 2016 15:06
Show Gist options
  • Save wilpig/6f9ebec88fbfd32e9413211026b9de8e to your computer and use it in GitHub Desktop.
Save wilpig/6f9ebec88fbfd32e9413211026b9de8e to your computer and use it in GitHub Desktop.
Vulnerability
Upon visiting /workorder.php (which has no access controls), if you set your cookie (which any attacker has arbitrary control over):
https://github.com/samilliken/openDCIM/blob/f7658f8bb0a0f1d0bf229bcc8bb234f7ffcc179e/workorder.php#L15-L22
Pay special attention to line 18.
https://github.com/samilliken/openDCIM/blob/f7658f8bb0a0f1d0bf229bcc8bb234f7ffcc179e/workorder.php#L31-L32
https://github.com/samilliken/openDCIM/blob/f7658f8bb0a0f1d0bf229bcc8bb234f7ffcc179e/workorder.php#L41-L42
You can specify (via cookie) the data that will be loaded into the spreadsheet.
https://github.com/samilliken/openDCIM/blob/f7658f8bb0a0f1d0bf229bcc8bb234f7ffcc179e/workorder.php#L84-L89
And the value you can specify from line 18 is used, without any sanitation, in the filename that the file is saved to.
How to Exploit
Send your payload in the connectionsMediaList cookie.
Make sure $dev->DeviceID contains some directory traversal (../../, ends in .php) and contains a poison NUL byte.
Access your payload. You have RCE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment