Odyssey | Security Researcher

Hook

During a source-code review of a laboratory operations platform, I identified a privilege-escalation issue that allowed an authenticated user to promote their own account to Django superuser.

The investigation revealed that the newly acquired privileges also provided access to sensitive controller configuration, including usernames, passwords, and additional authentication data.

Summary

The User API exposed the is_superuser attribute as a writable field. An authenticated user with the change_user permission could modify their own account and set this attribute to true.

After successfully escalating their privileges, the same user could access the Controller Card API and retrieve sensitive configuration and credentials in plaintext.

The issue created a chain involving:

  • Mass Assignment in the User API.

  • Privilege Escalation to Django Superuser.

  • Unauthorized Access to Controller Card APIs.

  • Disclosure of Controller Credentials.

Affected Endpoints:

  • PATCH /api/users/{user_id}/

  • GET /api/interlock_cards/

  • GET /api/interlock_cards/{card_id}/

Background

The application is a laboratory operations platform designed to manage equipment reservations, user permissions, maintenance workflows, and integrations with external hardware controllers.

One of its components manages controller configurations, including connection details and authentication credentials.

This investigation focused on the security boundaries between user management and controller management.

Discovery Process

The issue was discovered during a source-code review of the project's public repository.

While examining the User API serializer, I noticed that is_superuser, a security-sensitive attribute, was exposed as a writable field.

This raised the possibility that a user with permission to modify user records could also modify their own administrative privileges.

I followed the authorization logic and confirmed that the application did not properly separate ordinary user modifications from administrative privilege management.

Further testing revealed that successfully changing this attribute also provided access to the Controller Card API, exposing sensitive configuration and credentials.

Reproduction Steps

1. Self-Promotion Through the User API

Start with an authenticated non-superuser account holding the change_user permission.

Send a PATCH request to the account's own user endpoint:

Request:

http
PATCH /api/users/{attacker_id}/ HTTP/1.1
Host: redacted.com
Content-Type: application/json

{
  "is_superuser": true
}

Observed Response:

http
HTTP/1.1 200 OK

The account's is_superuser attribute was successfully modified, granting it Django superuser privileges.

2. Accessing Controller Configuration Before Escalation

Before privilege escalation, requesting an individual controller card was denied.

Request:

http
GET /api/interlock_cards/{card_id}/ HTTP/1.1
Host: redacted.com

Observed Response:

http
HTTP/1.1 403 Forbidden

The controller-card listing endpoint was also inaccessible before escalation.

Request:

http
GET /api/interlock_cards/ HTTP/1.1
Host: redacted.com

Observed Response:

http
HTTP/1.1 403 Forbidden

3. Accessing Controller Credentials After Escalation

After becoming a Django superuser, the same authenticated session could access the controller-card listing endpoint.

Request:

http
GET /api/interlock_cards/ HTTP/1.1
Host: redacted.com

Observed Response:

http
HTTP/1.1 200 OK

The individual controller-card endpoint also became accessible.

Request:

http
GET /api/interlock_cards/{card_id}/ HTTP/1.1
Host: redacted.com

Observed Response:

http
HTTP/1.1 200 OK

The API responses exposed the following properties:

Field

Description

username

Controller username

password

Controller password

server

Controller server address

port

Connection port

extra_args

Additional configuration arguments

The extra_args field may also contain authentication material, such as API tokens.

These values were returned directly in the API responses rather than being masked or excluded.

Impact

The issue demonstrated the following security impacts:

1. Privilege Escalation

An authenticated user with the required user-management permission could elevate their account to Django superuser.

2. Controller Credential Disclosure

The elevated account could retrieve controller usernames and plaintext passwords through the Controller Card API.

3. Infrastructure Information Disclosure

The API also exposed server addresses, connection ports, and additional controller configuration.

Proof of Concept

To validate the complete chain, I developed a self-contained local Proof of Concept.

The environment used a local SQLite database and synthetic records.

The PoC created its own test users, permissions, controller categories, controller cards, and associated objects.

The following checks were successfully reproduced:

Test

Result

Attacker starts as a non-superuser

PASS

Attacker has the required user-management permission

PASS

Control account without the permission is denied

PASS

Controller access before escalation is denied

PASS

Self-promotion request succeeds

PASS

Account becomes Django superuser

PASS

Controller listing becomes accessible

PASS

Controller detail becomes accessible

PASS

Synthetic username is disclosed

PASS

Synthetic password is disclosed

PASS

Synthetic API token is disclosed

PASS

Test data changes are rolled back

PASS

The PoC used synthetic credentials and did not contact external services or real controllers.

All test data changes were rolled back after execution.

Fix

The following changes are recommended:

  1. Remove security-sensitive fields such as is_superuser and is_staff from writable User API serializer fields.

  2. Make administrative privilege attributes read-only for ordinary users.

  3. Require explicit authorization for administrative privilege changes.

  4. Restrict Controller Card API access to explicitly authorized roles.

  5. Exclude passwords and authentication tokens from general-purpose API responses.

  6. Use an appropriate secret-management mechanism for sensitive controller configuration.

Lessons Learned

This investigation highlights several important security considerations:

  • User-management permissions should not automatically grant control over administrative privileges.

  • Security-sensitive model attributes must be handled carefully in API serializers.

  • Authorization checks must be consistent across related application components.

  • Sensitive credentials should never be exposed through general-purpose API responses.

A vulnerability in one component can have a much wider impact when combined with weaknesses elsewhere in the application.

Closing

This investigation was a reminder that source-code review is not just about finding vulnerable functions or endpoints. It is about understanding how different components interact and identifying where their security boundaries fail.

Sometimes, a single writable attribute is enough to expose a much broader security issue.


Odyssey