Kimai is a time tracking solution built on the typical LAMP stack. Multiple vulnerabilities were discovered that could allow remote code execution on the remote server. These appear to be fixed in their source repository (here), but none of the distribution packages (v0.9.2.1306-3) have the patched version.
On installation, a default administrative account is generated with the following credentials: admin:changeme. The /install/ folder is not automatically deleted, but instead a pop-up is shown each time the administrator logs in, alerting them that they should delete this folder in order to protect their system from malicious modifications. If this folder is not deleted, it could allow unauthenticated users the ability to wipe the remote system’s install of Kimai.
There are multiple directory indexes (
/kimai/libraries/) that disclose paths, version information, and files, as well as path disclosure (
/kimai/db_restore.php is an experimental page that can be used to restore, delete, and create backups of the Kimai system. This page can be accessed without authentication or authorization, and no audit log is generated. This page is vulnerable to SQLi when restoring a generated backup.
Once a backup is created, the recovery POST appears as such:
1 2 3 4 5 6 7 8 9 10 11 12 13
The initial request is pulled in from the following:
1 2 3 4 5
The tables are then queried, and the following code is executed:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
dates parameter is used within the query without sanitization, leading to a classic SQL injection vulnerability. This is quite serious as the page is accessible without needing to be authenticated or authorized to the Kimai system.
We can exploit this by generating a new backup, and running a typical SQLi, where the POST data appears as such:
This will dump all output from the query into the file ‘hacked’ on the remote server. Using this, we can dump one column from any table in the database.
Passwords are stored using the following:
This is quite weak, as the salt is static for each user and can be pulled from the include/autoconf.php file.
Session’s do not enforce any form of source verification, and thusly can be hijacked.
Here’s a run from the script:
1 2 3 4