| Название | ramon-victor (https://github.com/ramon-victor) freegpt-webui latest (main/master branch) CWE-362 (Race Condition / TOCTOU - non-atomic check-then-act wit |
|---|
| Описание | Race Condition - Mutable Shared Global State (TOCTOU on module-level dict) - Location: `server/config.py:getJailbreak function (~25-35)`. The getJailbreak function mutates the global, module-level `special_instructions` dictionary in-place on every call. The statement `special_instructions[jailbreak][0]['content'] += special_instructions['two_responses_instruction']` performs a non-atomic read-modify-write on shared state: it reads the current content string, concatenates the two-responses instruction, and writes the result back into the SAME global dict entry. There is no lock, no copy, and no transaction. Two business rules are broken: (1) configuration should be immutable per request, but here each request permanently lengthens the stored prompt; (2) concurrent requests can interleave the read and write, causing lost updates. The cumulative effect is that every successive request (concurrent or not) appends another copy of `two_responses_instruction` to the stored content for 'gpt-dan-11.0' or 'gpt-evil', so the prompt grows without bound until it exceeds the upstream model's token/context limit, at which point the jailbreak feature fails for ALL users of the instance. Exploitation: 1. Attacker sends POST {url_prefix}/backend-api/v2/conversation with JSON body containing jailbreak='gpt-dan-11.0' (or 'gpt-evil').
2. _conversation -> build_messages -> getJailbreak executes `special_instructions['gpt-dan-11.0'][0]['content'] += two_responses_instruction`, permanently mutating global state.
3. Attacker repeats the request N times (e.g., via a simple loop or concurrent threads). The stored content now contains N extra concatenated copies of the instruction text.
4. After enough iterations, the prompt sent to the upstream provider exceeds the token limit; every subsequent jailbreak request by ANY user returns an error from the provider, effectively a persistent denial-of-service on the jailbreak feature.
5. Under concurrency the += read-modify-write can also drop updates, but the dominant impact is the unbounded accumulation that corrupts shared configuration for all users.
|
|---|
| Источник | ⚠️ https://gist.github.com/Galaxync/04108fe7068324c998f33c5713105709 |
|---|
| Пользователь | Galaxyn (UID 98388) |
|---|
| Представление | 19.07.2026 03:58 (2 месяцы назад) |
|---|
| Модерация | 04.09.2026 16:49 (2 months later) |
|---|
| Статус | принято |
|---|
| Запись VulDB | 398821 [ramon-victor freegpt-webui до 098db3dfeb41555c2ca9269df0f13e10ec1c35dc Jailbreak Mode server/config.py getJailbreak состояние гонки] |
|---|
| Баллы | 20 |
|---|