Patient to root in GNU Health Thalamus: mass assignment to full account takeover
Thalamus merges a client's JSON straight into their person record and checks only that they do not change the id. A patient-tier account can set its own roles to root, then read every demographic and password hash in the federation and take over any account. Proven on 0.9.18, the current release. Unpatched, vendor unresponsive after 90 days.
Thalamus is the server at the centre of a GNU Health federation. Other nodes authenticate against it and pass patient demographics through it. On the version shipping right now, any patient-tier account can edit its own record to make itself root, and from there read every demographic record and password hash in the federation and reset the password on any account, administrators included. There is no fix out yet.
I reported this privately to GNU Solidario on 26 August 2026 with a 90-day deadline. In line with responsible disclosure I held the details until that window closed; they never replied, so it is now public, with the exploit steps left out. I confirmed all of it against Thalamus 0.9.18, the current release.
Where the bug lives
Thalamus keeps each person as a JSON document in a Postgres table called people. The endpoint that edits a person is PATCH /people/<person_id>, and what it does is plain enough: it takes the JSON you send and merges it into your stored document. The one thing it refuses is a change to the id. Whatever else you put in the body gets written.
the person update handler, Thalamus 0.9.18
// thalamus/thalamus.py Person.patch()
def patch(self, person_id):
values = json.loads(request.data)
if 'id' in values: # the only field it refuses
abort(422, error="Not allowed to change the person ID")
if check_id('people', person_id):
# everything else in the body gets merged in
cur.execute(
"UPDATE PEOPLE SET data = data || %s where id = %s",
(json.dumps(values), person_id))That || is a JSONB merge in Postgres, so any key you send overwrites the same key in the record. The query is parameterised, so this is not SQL injection. The trouble is what you are allowed to send. Nothing here tells a demographic field apart from a security one, which leaves roles and password as editable as someone’s phone number.
From patient to root
You still have to get past the authorization check to reach that handler. The default roles.cfg gives the end_user role, the one patient accounts get, PATCH access to the person resource, with global set to false. In this code that resolves to a single permission: you can edit your own record.
the authorization gate
// thalamus/thalamus.py access_control()
if view_args:
if (username == view_args["person_id"] or
actions["global"] == "True"):
return TrueEditing your own record is allowed, and editing it lets you set any field in it. So a patient account puts roles in the body along with whatever else it is sending. The next time it calls the server, Thalamus reads the new role back out of the database, and the account is root. Handing someone a role is meant to be an administrator’s job. It is going through the same self-service edit anyone can run on their own record.
What root gets you
With root, global is true and the self-only limit in the gate stops applying. GET /people now runs SELECT data from people with nothing to narrow it and hands back every person in the federation: their demographics, their identifiers, and the bcrypt password hash stored on each account. The same PATCH still takes a password field, so the attacker can set a new password on anyone’s account and log in as them, administrators among them. All of it starts from the least privileged account the system issues.
Severity
I put it at CVSS 3.1 8.8 (High), CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. It is reachable over the network, it is easy to pull off, it needs one low-privilege account and no user interaction, and once you are root every record is yours to read, change or delete. The weakness is mass assignment (CWE-915), and what it buys is a privilege-management failure (CWE-269). roles and password had no business being settable through a self-service edit. The id check is the galling part: someone knew this endpoint needed a limit, and then put the limit on the one field that could not do any harm.
Exposure
Thalamus is built to sit on a trusted network and relay between nodes, and the project tells you not to put its ports on the internet. A passive look turns up only a handful of hosts reachable publicly, and I did not touch any of them, so nobody is going to spray this across the internet. The person who can actually use it is an insider, anyone holding a patient-tier account, or an attacker already sitting on the internal or federation network. For that person the payoff is large: one ordinary login becomes the whole federation, patient data and password hashes on every node included. What makes this one worth your attention is how much it gives up and how sensitive that data is, rather than how many boxes you could reach it on.
No patch yet, so what to do
Until GNU Solidario ships a fix, assume the person-edit endpoint can hand out admin, because it does. A few things you can control:
- Keep Thalamus off untrusted networks and check that nothing outside your trusted segment can reach its ports. That does not close the bug. It cuts down who can get to it.
- Assume any
end_useraccount can turn itself intoroot. Go back through who holds an account and drop the ones that should not exist. - If you have a reverse proxy in front of it, you can reject
PATCHbodies on the person endpoint that carry arolesorpasswordkey. It is a stopgap; real role and password changes go through their own endpoints anyway. - Watch for an account that becomes
rootwithout an administrator doing it, and for anything pulling the fullpeoplelist.
The proper fix is to let the handler take only a named set of demographic fields and ignore the rest, roles, password and active among them. Role changes belong in their own authorized operation, and passwords should only go through the existing hashed-password endpoint. The reason to name the fields you allow, rather than block the ones you do not, is that blocking only works if you remember every dangerous field, and here roles and password were the ones that got missed. While someone is in there, the people read should be scoped, and it should stop returning the password field at all.
Disclosure and timeline
I reported it privately to GNU Solidario (security@gnuhealth.org, health@gnusolidario.org and falcon@gnuhealth.org) on 26 August 2026, with the full technical detail, a reproduction, and a 90-day deadline. Nothing came back in that time. I am publishing on 24 November 2026 with the mechanism and the impact but not the exploit steps, and I have requested a CVE through MITRE. If a fix ships I will note the fixed version here. If you maintain Thalamus and want the full report with the reproduction, email me and it is yours.
To score it against your own setup, our CVSS calculator does 3.1 and 4.0, and our disclosure page lays out how we handle a report like this.