CVE-2026-138286 CRITICAL 10.0 난이도Difficulty 입문Intro
AutoCua Telegram 원격 제어가 "저장된 소유자 없음"을 "처음 메시지를 보낸 사람이 소유자"로 처리함AutoCua Telegram remote control treats "no owner saved" as "first caller becomes owner"
CVE-2026-138286는 AutoCua의 Improper Authentication(CWE-287) 취약점으로, CVSS 10(CRITICAL)입니다. 영향 버전: ≤ 0.1.9. 수정 버전: 0.2.0.CVE-2026-138286 is an Improper Authentication (CWE-287) vulnerability in AutoCua, rated CVSS 10 (CRITICAL). Affected: ≤ 0.1.9. Fixed in: 0.2.0.
| 제품Product | AutoCua |
|---|---|
| 영향 버전Affected | ≤ 0.1.9 |
| 수정 버전Fixed in | 0.2.0 |
| 심각도Severity | CVSS 10 CRITICAL |
| 취약점 유형Weakness | CWE-287 Improper Authentication |
| 공격 조건Attack conditions | 원격 (네트워크) · 인증 불필요 · 사용자 상호작용 불필요Remote (network) · No authentication · No user interaction |
1. TL;DR
AutoCua는 컴퓨터 사용(computer-use) 에이전트입니다. Telegram 원격 제어 서비스를 통해 채팅 메시지로 사용자 컴퓨터에서 작업을 시작할 수 있습니다. 0.1.9 이하 버전에서는 “이 채팅이 소유자인가?”를 확인하는 _is_owner_chat이 소유자 기록이 없는 상태를 “아직 아무도 이 봇을 점유하지 않음”으로 취급했습니다. 그러면 봇에 처음 메시지를 보낸 채팅이 소유자로 받아들여져 저장되었습니다. 이 상태에서는 봇의 사용자명을 아는 Telegram 사용자 누구나 봇을 장악할 수 있었습니다. 0.2.0 버전은 이 선착순 점유 방식을 PC에 표시되는 일회용 페어링 코드로 대체합니다. 채팅이 페어링되기 전까지 봇은 누구의 명령도 따르지 않습니다.
출처: issue #85, 수정 커밋, v0.2.0 릴리스 노트.
2. Flaw 분류
| 항목 | 값 |
|---|---|
| 주요 CWE | CWE-287 Improper Authentication (NVD 기준) |
| 제품 / 구성 요소 | ComputerUseAgent AutoCua, Telegram Remote-Control Service (AutoCua/mac/remote_connection/telegram/service.py) |
| 영향받는 버전 | 0.1.9 이하 (NVD 설명 기준). 0.2.0에서 수정됨. |
| 공격 벡터 | 네트워크. 공격자가 Telegram을 통해 봇에 메시지를 보냄. |
| 영향 | CVSS 기준: 기밀성·무결성·가용성 모두 높음, 범위 변경(scope changed). 실제로는 공격자가 기기를 제어하는 에이전트에 작업을 지시할 수 있었음. |
| 사전 조건 | 봇에 저장된 소유자가 없음. 한 번도 페어링되지 않은 봇이거나, 키 파일에서 소유자 줄이 사라진 봇(3절 참조). 공격자는 봇의 사용자명을 알아야 함. 보고자에 따르면 토큰은 필요 없음. |
| CVSS | 10.0 CRITICAL, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H (제공된 CVE 레코드 기준, REVIEW_NOTES 참조) |
3. 근본 원인
봇은 발신자의 채팅 ID를 로컬 키 파일(api_key.txt)에 저장된 소유자 ID와 비교하여 누가 기기를 제어할 수 있는지 결정합니다. 이 ID는 TELEGRAM_OWNER_CHAT_ID 줄에 저장됩니다.
보고자(issue #85)는 서로 결합되는 두 가지 설계 문제를 설명합니다.
- 부재(absence)를 최초 실행으로 해석함. 소유자 줄이 없거나 파싱할 수 없으면 조회 결과는 “값 없음”이 됩니다.
_is_owner_chat()검사는 이를 “아직 아무도 봇을 점유하지 않음”으로 취급합니다. 그리고 발신자를 새 소유자로 저장한 뒤 “승인됨”을 반환합니다. 시작 훅(startup hook)도 저장된 소유자가 없으면 대기 중인 최신 Telegram 업데이트의 채팅을 소유자로 채택했습니다. - 소유자 줄이 사라질 수 있음. 키 파일 기록기는 파일을 비운 뒤 줄을 하나씩 다시 썼습니다. 따라서 도중에 충돌이 나거나, 디스크가 가득 차거나, 동시 저장이 일어나면 소유자 줄이 없는 유효한 파일이 남을 수 있었습니다.
핵심 실수는 인증 판단에서의 fail-open 기본값입니다. 오류 상태(“소유자 알 수 없음”)와 정상적인 초기 상태(“아직 페어링되지 않음”)가 같은 분기에서 처리되었습니다. 그 분기는 가장 먼저 도착한 사람에게 접근 권한을 주었습니다.
커밋 메시지는 수정 전 동작을 이렇게 서술합니다. 봇은 처음 메시지를 보낸 채팅에게, 또는 시작 시점에 대기 중인 최신 업데이트의 채팅에게 제어권을 주었습니다.
보고자는 또한 소유자 ID가 Telegram 채팅과 기기 사이의 유일한 권한 부여 수단이라고 지적합니다. 봇 토큰은 판단에 포함되지 않으며, 이후 단계에서 점유자를 다시 확인하지도 않습니다. 이는 보고자의 주장입니다.
4. 익스플로잇 흐름(개념)
아래 단계는 개념만 설명합니다. 메시지나 입력값은 제시하지 않습니다.
- 대상 봇 찾기. Telegram 봇은 사용자명을 아는 누구나 접근할 수 있습니다. 공격자에게 필요한 것은 그 사용자명뿐입니다.
- 소유자 없는 상태를 기다리거나 그 상태에 의존. 봇은 한 번도 페어링되지 않았거나 소유자 줄이 사라져서 저장된 소유자가 없습니다.
- 아무 메시지나 전송. 공격자 채팅의 첫 메시지가 소유권 검사에 도달합니다.
- 검사가 “소유자 없음”을 “나를 점유하라”로 처리. 발신자가 소유자로 기록되고 승인됩니다. 이후 실제 소유자는 무시됩니다.
- 작업 지시. 서비스는 공격자의 메시지를 호스트의 computer-use 에이전트에 대한 지시로 받아들입니다.
- 봇 사용자명 확인 — 공개 핸들
- 소유자가 저장되지 않은 동안 봇에 메시지 전송
- 소유권 검사가 발신자를 자동 점유
- 공격자가 소유자로 저장됨
- 에이전트가 기기에서 공격자의 작업을 실행 — 영향
5. 트리거 조건
- AutoCua 버전이 0.1.9 이하입니다 (NVD 기준).
- Telegram 원격 제어 기능이 구성되어 실행 중이며, 봇이 폴링하고 있습니다.
- 저장된 소유자가 없습니다. 보고자가 제시한 경로는 소유자 줄이 사라진 경우입니다. 커밋 메시지는 첫 메시지 점유도 설명합니다.
- 공격자가 Telegram에서 봇에 메시지를 보낼 수 있습니다. 봇이 Telegram API로 외부 연결을 하므로 피해자 머신에 대한 네트워크 접근은 필요하지 않습니다.
- 소유자가 이미 저장되어 있고 파일이 온전하면, 보고자의 대조 테스트에서 검사가 다른 채팅을 거부하는 것으로 나타납니다.
6. 패치 분석
수정은 커밋 c3191fa, “Telegram: pair the bot with a one-time code shown on the PC (#85)“입니다. PR #87을 통해 병합되었습니다. v0.2.0 릴리스 노트는 이를 Security 항목에 기재합니다.
커밋 메시지가 밝히는 변경 내용:
- 봇은 더 이상 처음 메시지를 보낸 채팅이나 시작 시점의 대기 중인 최신 업데이트를 승인하지 않습니다. 저장된 소유자가 없으면 누구의 명령도 따르지 않습니다.
- Connect가 일회용 코드를 생성하며, 이 코드는 배너와 Settings > Remote Connection에 표시됩니다. 이 코드를 담은 새 비공개 채팅 메시지만, 그리고 폴링 중인 봇에서만 봇이 페어링됩니다.
- 소유자는 양수 ID(비공개 채팅)여야 합니다. 그룹, 채널, 수정된 메시지, 비즈니스 메시지는 페어링되지 않으며 텍스트 핸들러에도 도달하지 않습니다.
- Disconnect는 토큰, 소유자, 코드를 한 번의 쓰기로 지웁니다.
api_key.txt는 임시 파일에 쓴 뒤 이름을 바꿔 제자리에 놓습니다. 모든 읽기-수정-쓰기 작업은 하나의 락을 사용하므로, 충돌, 디스크 가득 참, 병렬 저장으로 파일이 비어 버리는 일이 없습니다.
diff 중 AutoCua/__init__.py 부분만 볼 수 있었습니다. 가져온 페이지에서는 service.py diff가 보이지 않았으므로, 소유권 검사의 변경은 개념적으로 설명합니다(REVIEW_NOTES 참조). 보이는 부분은 원자적 쓰기 헬퍼이며, 요약된 형태로 아래에 나타냅니다.
api_key_lock = threading.RLock()
def replace_file_text(path: Path, text: str) -> None:
fd, tmp = tempfile.mkstemp(dir=str(path.parent), prefix=path.name + ".", suffix=".part")
...
os.fsync(f.fileno())
os.replace(tmp, str(path))이 변경이 흐름을 끊는 이유: 소유자 줄이 빠진 채 반쯤 쓰인 키 파일이라는 2단계를 막습니다. 이제 파일에는 이전 내용이나 새 내용 중 하나만 들어 있고, 기록은 락으로 직렬화됩니다. 핵심 방어는 service.py의 페어링 변경입니다. “소유자 없음”이 더 이상 “접근 허용”을 뜻하지 않으므로 흐름의 4단계는 일어날 수 없습니다. 점유하려는 쪽은 PC에 표시되는 일회용 코드를 제시하여 물리적 또는 로컬 접근 권한을 증명해야 합니다.
새 페어링 코드가 안전하게 생성·비교되는지(예: 엔트로피와 일회성)는 diff에서 검토하지 않았으며 여기서 확인되지 않았습니다.
7. 탐지·완화
즉시 조치
- NVD 설명과 릴리스 노트에 명시된 대로 AutoCua를 0.2.0 이상으로 업그레이드하십시오.
- 업그레이드할 수 없다면 해당 머신에서 Telegram 원격 제어 기능을 중지하십시오. 이 기능이 영향받는 구성 요소입니다.
- 업그레이드 후 봇이 예상한 채팅과 페어링되었는지 확인하십시오. 확인할 수 없다면 Disconnect(토큰, 소유자, 코드를 지움)를 사용한 뒤 새 코드 방식으로 다시 페어링하십시오.
- Telegram BotFather에서 봇 토큰을 폐기하고 재발급하는 것을 고려하십시오. 이는 일반적인 예방 조치이며 벤더가 밝힌 내용은 아닙니다. 봇을 제어한 사람이 토큰을 보았거나 사용했을 수 있습니다.
탐지
AutoCua_data/api_key/api_key.txt에TELEGRAM_OWNER_CHAT_ID줄이 있는지, 그 값이 본인의 채팅 ID인지 확인하십시오. 모르는 ID라면 봇이 다른 사람에게 점유된 것입니다. (경로와 키 이름은 보고자의 issue에서 가져왔습니다.)- 에이전트의 작업 기록이나 Telegram 봇 채팅에서 본인이 시작하지 않은 작업이 있는지 검토하십시오.
- 제품이 소유권 변경을 로그로 남기는지는 공개된 출처에서 확인되지 않습니다.
격리된 실습(로컬 Docker 랩)
이 취약점은 인터넷과 격리된 로컬 Docker 랩에서만 재현하십시오. 실제 Telegram 봇, 실제 토큰, 본인 소유가 아닌 머신을 대상으로 테스트하지 마십시오.
- 외부 네트워크가 없는 컨테이너에서 이전 버전을 실행합니다.
- 보고자가 했던 것처럼 Telegram API를 로컬 모의(mock) 서버로 대체합니다.
- 소유권 상태(존재, 부재, 손상)에 따라 권한 부여 결과가 어떻게 달라지는지 살펴본 뒤, 0.2.0에서 같은 과정을 반복합니다.
- 일회용 키 파일을 사용하고 실제 자격 증명은 사용하지 않습니다.
8. References
1. TL;DR
AutoCua is a computer-use agent. Its Telegram remote-control service lets a chat message start tasks on the user’s computer. In versions up to 0.1.9, the check for “is this chat the owner?” (_is_owner_chat) treated a missing owner record as “nobody has claimed this bot yet”. The first chat to message the bot was then accepted as owner and saved. Any Telegram user who knew the bot’s username could take it over in that state. Version 0.2.0 replaces this first-come claim with a one-time pairing code shown on the PC. Until a chat pairs, the bot obeys nobody.
Sources: issue #85, fix commit, v0.2.0 release notes.
2. Flaw classification
| Item | Value |
|---|---|
| Primary CWE | CWE-287 Improper Authentication (per NVD) |
| Product / component | ComputerUseAgent AutoCua, Telegram Remote-Control Service (AutoCua/mac/remote_connection/telegram/service.py) |
| Affected versions | Up to 0.1.9 (per the NVD description). Fixed in 0.2.0. |
| Attack vector | Network. The attacker sends messages to the bot through Telegram. |
| Impact | Per CVSS: high confidentiality, integrity and availability, with scope changed. In practice, the attacker could issue tasks to an agent that controls the device. |
| Prerequisites | The bot has no stored owner. This is a never-paired bot, or one whose key file lost the owner line (see Section 3). The attacker must know the bot’s username. No token is needed, according to the reporter. |
| CVSS | 10.0 CRITICAL, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H (CVE record as supplied; see REVIEW_NOTES) |
3. Root cause
The bot decides who may control the device by comparing the sender’s chat ID with an owner ID stored in a local key file (api_key.txt). The ID is stored on a TELEGRAM_OWNER_CHAT_ID line.
The reporter (issue #85) describes two design problems that combine:
- Absence is read as a first run. When the owner line is missing or unparsable, the lookup returns “no value”. The check
_is_owner_chat()treats that as “no owner has claimed the bot yet”. It saves the sender as the new owner and returns “authorized”. The startup hook also adopted the chat of the latest pending Telegram update when no owner was stored. - The owner line can be lost. The key-file writer truncated the file and then rewrote the lines one by one, so a crash, a full disk or a concurrent save in the middle could leave a valid file without the owner line.
The core mistake is a fail-open default in an authentication decision. An error state (“owner unknown”) and a legitimate initial state (“not yet paired”) were handled by the same branch. That branch granted access to whoever arrived first.
The commit message states the pre-fix behavior as: the bot gave control to the first chat that messaged it, or, at startup, to the chat of the latest waiting update.
The reporter also notes that the owner ID is the only authorization between a Telegram chat and the device. The bot token is not part of the decision, and nothing downstream re-checks the claimant. This is the reporter’s claim.
4. Exploit flow (conceptual)
The steps below describe the idea only. No messages or inputs are given.
- Find the target bot. A Telegram bot is reachable by anyone who knows its username. The attacker needs only that username.
- Wait for or rely on an unowned state. The bot has no stored owner, either because it was never paired or because the owner line was lost.
- Send any message. The first message from the attacker’s chat reaches the ownership check.
- Check treats “no owner” as “claim me”. The sender is recorded as the owner and authorized. The real owner is then ignored.
- Issue tasks. The service accepts the attacker’s messages as instructions for the computer-use agent on the host.
- find bot username — public handle
- message bot while no owner is stored
- ownership check auto-claims sender
- attacker saved as owner
- agent runs attacker's tasks on the device — impact
5. Trigger conditions
- The AutoCua version is 0.1.9 or earlier (per NVD).
- The Telegram remote-control feature is configured and running, so the bot is polling.
- No owner is stored. The reporter’s route is a lost owner line. The commit message also describes the first-message claim.
- The attacker can message the bot on Telegram. Network access to the victim’s machine is not required, because the bot connects outward to Telegram’s API.
- If the owner is already stored and the file is intact, the reporter’s control test shows the check refuses other chats.
6. Patch analysis
The fix is commit c3191fa, “Telegram: pair the bot with a one-time code shown on the PC (#85)”. It was merged through PR #87. The v0.2.0 release notes list it under Security.
What the commit message says it changes:
- The bot no longer authorizes the first chat that messages it, or the latest pending update at startup. With no owner saved it obeys nobody.
- Connect generates a one-time code, shown in the banner and in Settings > Remote Connection. Only a new private-chat message that carries the code pairs the bot, and only on the bot that is polling.
- The owner must be a positive ID (a private chat). Groups, channels, edits and business messages never pair or reach the text handler.
- Disconnect clears the token, owner and code in one write.
api_key.txtis written to a temp file and renamed into place. All read-change-write operations take one lock, so a crash, a full disk or parallel saves cannot leave the file empty.
I could only see the AutoCua/__init__.py part of the diff. The service.py diff was not visible in the fetched page, so the ownership-check change is explained conceptually (see REVIEW_NOTES). The visible part is the atomic-write helper, shown here in condensed form:
api_key_lock = threading.RLock()
def replace_file_text(path: Path, text: str) -> None:
fd, tmp = tempfile.mkstemp(dir=str(path.parent), prefix=path.name + ".", suffix=".part")
...
os.fsync(f.fileno())
os.replace(tmp, str(path))Why this breaks the flow: it closes step 2, a half-written key file that drops the owner line. The file now holds either the old content or the new content, and writers are serialized by a lock. The main defense is the pairing change in service.py. With “no owner” no longer meaning “grant access”, step 4 of the flow cannot happen. A claimant must prove physical or local access by presenting a one-time code displayed on the PC.
Whether the new pairing code is generated and compared securely, for example its entropy and single use, was not reviewed from the diff and is not confirmed here.
7. Detection & mitigation
Immediate actions
- Upgrade AutoCua to 0.2.0 or later, as stated in the NVD description and release notes.
- If you cannot upgrade, stop the Telegram remote-control feature on that machine. This feature is the affected component.
- After upgrading, check that the bot paired to the chat you expect. If you cannot tell, use Disconnect (which clears the token, owner and code) and pair again with the new code flow.
- Consider revoking and regenerating the Telegram bot token with Telegram’s BotFather. This is a general precaution, not something the vendor stated. Anyone who controlled the bot may have seen or used it.
Detection
- Check whether
AutoCua_data/api_key/api_key.txthas aTELEGRAM_OWNER_CHAT_IDline, and whether its value is your own chat ID. An unknown ID means the bot was claimed by someone else. (The path and key name are from the reporter’s issue.) - Review the agent’s task history or the Telegram bot chat for tasks you did not start.
- Whether the product logs ownership changes is not confirmed in public sources.
Isolated practice (local Docker lab)
Reproduce this only in a local Docker lab isolated from the internet. Do not test against a real Telegram bot, a real token or any machine you do not own.
- Run the old version in a container with no outbound network.
- Replace Telegram’s API with a local mock server, as the reporter did.
- Study how ownership state (present, absent, corrupted) changes the authorization result, then repeat on 0.2.0.
- Use a throwaway key file and no real credentials.
8. References
- ComputerUseAgent/AutoCua issue #85, the reporter’s description
- Fix commit c3191fa
- Pull request #87
- Release v0.2.0
- VulDB entry 445111 (CVE-2026-138286)