SQL injection through a network route endpoint reachable by any logged-in user (database read, admin hash)
Affected version: v2.4.7 (commit 961a7f4a0e99cfb7ca58f81f9a957b7a71075c1b); the default branch (23997371358f62e9fc0abeb8e2f4be02a21a8551) has the same code.
Summary
A network routing endpoint for virtual machines is reachable by any logged-in user without an administrator check, and one of its path parameters is placed into an SQL statement as a column name without validation. An ordinary user can therefore inject SQL, read arbitrary data from the application database one character at a time through a second endpoint that returns the stored value, and obtain the administrator's password hash. Passwords are stored as unsalted SHA-1, so weak passwords can be cracked quickly and the administrator account taken over.
Details
The sibling endpoints that manage networks check for administrator or network grants. This endpoint and the listing endpoint it relies on only check that a session exists, and the field name from the request is concatenated into an UPDATE or INSERT statement. The value is returned to the caller through an integer column read, which gives a one-character-per-request extraction channel.
Steps To Reproduce
(available upon request)
Impact
Any user with an account (created by an administrator, or via LDAP or OpenID) can read the whole database, including all password hashes, and write to it. In my test, an ordinary user with no grants extracted the database version, the database user and the administrator's hash (about 80 requests), and after cracking a deliberately weak administrator password logged in as administrator. Controls: the same user was refused on the administrator routes and on the network management routes. Not demonstrated: cracking a strong password, and a KVM-backed deployment (the lab used the project's test backend; these routes only touch the database). Tested in a local throwaway deployment of the tagged release.
Hello @carfeii thanks for your report. Can you send further information about this issue ? The mail address [email protected] is read only by the two lead developers.
sure - sent