MAX security: what reaches the disk and the network — MAX
Understand MAX CLI permissions, account credentials, local storage and confirmation controls.
Choose what your agent may do and understand where login data and messages are stored. This guide explains the protections, their limits and the settings you can check before granting sending or other changes.
Read this page before giving an AI agent or script access to your MAX account through max, or to understand what it saves on your computer. It explains login storage, disk writes, network destinations, send protections and leaked-token recovery. You can then assess what a person with computer access or an agent with max access may do.
Terms used below:
- Token — the credential keeping your MAX login active. Anyone holding it can use the account.
- Shared local archive — the unencrypted database where
maxandtgsave messages on your computer. - Send protections — permission, recipient-list and hourly-limit checks before changes reach MAX.
What max and tg share — the local copy of conversations, protection against wrong sends, agent permissions, other people's text on screen, what others on the machine can see, and how to report a vulnerability — is described on the shared security page. This page covers only what is specific to MAX.
Safeguards at a glance
What any WireCat tool protects against is on the shared page. Specific to MAX:
- The background server also checks profile limits. Permissions, the recipient list and the hourly limit are checked by both the command and
max personal serve, even for a program connecting directly to its socket (below). - Token.
maxdoes not save a token fromMAX_TOKENor pass it to the background server. The server does not disclose tokens to socket clients (below). - Network. Files download over HTTP(S) through the normal network transport, including local networks, within the configured size limit. MAX frames and decompressed data have limits; connections have timeouts (below).
- Account.
maxis not an official app, and the MAX rules do not allow such programs without the company's consent (below).
Token storage
The operating-system keyring uses service max-cli and an entry named after the profile. The token is not stored in configuration, command arguments, shell variables or history unless you explicitly supply it through the supported environment variable.
Without a keyring, it goes into ~/.config/max-cli/credentials.json with permissions 0600; the command reports this on stderr. max personal doctor also identifies file storage rather than keyring storage.
MAX_TOKEN overrides the keyring, supporting CI. A token provided through the variable remains only there:
- If MAX rotates the session token,
maxsaves it neither to the keyring nor to a file, and reports this on stderr. Otherwise a machine without a keyring could leave a live token in a file later copied into build caches or artifacts. - A command using
MAX_TOKENdoes not start backgroundmax personal serveor pass it the variable. Otherwise a one-command token could remain in a process for another fifteen minutes.
The max sales bot token is stored separately under the same max-cli service, in bot:<профиль>, or in the same 0600 file when no keyring exists. MAX_BOT_TOKEN overrides the keyring like MAX_TOKEN. max sales bot auth set checks the token with MAX before saving, so a typo does not overwrite a working token. It never saves a token from MAX_BOT_TOKEN.
Configuration cannot contain secrets: the schema has no token, phone-number or chat-ID fields.
Other data written to disk
| Data | Location | Permissions |
|---|---|---|
Profile state: device, login counter, viewerId | ~/.local/share/max-cli/profiles/<профиль>.json | 0600 |
| Configuration | ~/.config/max-cli/config.json | folder 0700, file 0600; doctor names open ones |
Run records for every run: successful ones for 7 days, failed ones for 30 (record false keeps only failed ones): command words, IDs, timings, error code; the command line as you typed it, without secrets (record_input false hides what you typed, diagnostics) | ~/.local/share/max-cli/runs/… | Directory 0700, files 0600 |
| Send log, always: chat, time, ID, length, outcome; no text | ~/.local/share/max-cli/sends/<профиль>.jsonl | Directory 0700, files 0600 |
| Recipient allowlist, if enabled | ~/.local/share/max-cli/profiles/<профиль>.recipients.json | 0600 |
Group moderation rules, after the first chats rules set | ~/.local/share/max-cli/profiles/<профиль>.moderation.json | 0600 |
Bot: seen chats, send log, recipient list, watch position | ~/.local/share/max-cli/bots/… | Directory 0700, files 0600 |
Shared message store for personal accounts, bots and tg, including text, voice transcripts, downloaded attachment paths and their extracted text | ~/.local/share/WireCat/wirecat.db | Directory 0700, file 0600 |
Background max personal serve socket and log | ~/.local/share/max-cli/profiles/<профиль>.sock, .serve.log | 0600 |
| Old profile cache; no longer opened | ~/.cache/max-cli/<профиль>.db and its -wal, -shm files | Directory 0700, files 0600 |
Conversation export, only through max personal store export --output | Your chosen destination | 0600 |
Downloaded attachments, max personal messages download or max personal attachments extract --download --output-dir | Current directory or --output | 0600 |
Problem report, only through max personal doctor reports create | Current directory or --output | 0600 |
Speech models, only after max personal models download | ~/.local/share/WireCat/models/audio/… | Directory 0700, files 0600 |
⚠ The shared local store contains message text and voice transcripts: it exists to answer offline. max personal session end does not remove it. max personal store clear --left --allow-dangerous removes only data for departed chats; there is no command to erase the entire shared store.
Old profile cache files are no longer opened. If they remain, max personal doctor shows their path; you can delete them separately without affecting the shared store.
Conversation content also exists in bot storage, exports and downloaded files; bot chat lists contain chat titles. Other items in the table contain no conversation content.
If someone obtains your computer
Only full-disk encryption protects against someone who obtains the disk — see the shared page. On Windows, access to files depends on the permissions of your user directory and the chosen MAX_*_DIR directories; the permission numbers in the table apply to Unix.
Preventing sends to the wrong place
Why protection against wrong sends is needed and how it works is described on the shared page. Before each write — a message, reaction, edit, forward or deletion — max checks everything in the table below, then logs the attempt.
In the examples below, agent is the name of a profile you created just for the agent; use your own.
A ban by level or by MAX_READ_ONLY takes effect before connecting to MAX. The chat is not looked up, so the refusal line
in the log is shorter: the command key (messages.send) and the kind of write, and the chat only if the command gives its numeric id.
--dry-run under MAX_READ_ONLY gives the same refusal and writes nothing to the log.
Bots have their own bot.* keys, such as bot.messages.send. They use the same levels. Common settings and bot.defaults/bot.profiles layers resolve in the same order; config show --bot reports effective permissions.
Each bot has its own recipient list (max <имя> bot recipients add <чат>) and log (max <имя> bot sends list). Every write passes them, including messages send, messages pin and bot api, preventing a generic API call from bypassing safeguards. Edits and deletions take the chat first: max fetches the message and refuses if it belongs to another chat. This comparison is unavailable for a chat addressed as user:<id>. Logs contain chat, action, outcome and text length, but not text. Bots have no hourly limit unless configured in bot: max <имя> config set --bot sends_per_hour 200.
The background server max personal serve performs the same checks for everything passing through it, including requests from programs connected directly to its socket rather than through max. It accepts only requests known to max, in the form max sends them; for example, it rejects deleting an entire chat. Changes made with config set apply immediately without restarting the server.
Account changes — contacts, profile, folders and sessions — also respect read-only mode. Recipient lists and hourly limits do not apply because these actions have no destination chat or message recipient. They are logged as account with the action, without names, numbers or titles.
The recipient list is optional: before anything is added, any chat is allowed. An enabled but empty list allows no destinations. When enabled, chats create <название> <люди…> and chats members add accept only people whose direct chat is listed. New group members cannot see older messages unless --history is supplied. Scheduled messages count in their send hour. Simultaneous commands cannot exceed the limit: capacity is held from checking until MAX responds. Clearing departed-chat data does not touch the send journal.
⚠ What these checks cannot prevent. The checks are inside max itself: an agent with shell access can remove them. Which external boundary to set is described on the shared page. For max: MAX_PROFILE_LOCK fixes the profile, not MAX_PROFILE; --file and bot uploads put reject known credential files and folders, max directories and the message store unless --allow-any-file is set. Ordinary hidden working folders are allowed; MCP offers no bypass.
Actions the tool never takes on its own
- Does not mark read without a request. Fetching history and marking read are separate protocol operations. Only
max personal chats mark-readsends the latter; ordinary reading does not. - Makes only requested changes. Changes come from
messages send|edit|delete|forward|pin|unpin|press,reactions add|remove,polls vote|close|create,contacts add|remove|import|rename|block|unblock,account update,account sessions end,session end,chats join|leave|create|update|start|app,chats members|admins …,chats requests confirm|reject,chats links reset,chats folders create|update|delete|order,chats moderate(within group rules),chats mark-read. Each performs the requested command-line action.max commands --jsonmarks themeffects.remote: "write". - Deletion asks by default.
messages.deleteataskrequires terminal confirmation or--allow-dangerous; explicitallowdeletes without asking. Deleting for everyone also requires--for-everyone, which the general MCP tool does not permit. - Keeps phone numbers off command lines.
contacts lookupreads interactively or through a pipe;contacts importreads a file.psand shell history can expose arguments. Errors, send journals and run records omit the number;max personal session startandmax personal account showmask it. - Does not log messages, including truncated text or hashes (diagnostics).
The exception is text you typed on the command line yourself: it can stay in a run record's
argvuntilrecord_inputis turned off (what you typed). - Does not use intermediaries. Network destinations lists connections. There is no project telemetry;
max personal servesends MAX one service event like a hidden web-client tab, explained there. - Keeps its connection in
max personal serve. The first command needing MAX starts it in the background; it stops after 15 idle minutes. Disable this withmax personal config set serve false.
Untrusted text in your terminal
Names, titles and text from other people cannot control the terminal: control and invisible characters are displayed as text, names are printed on one line, and completion inserts only numbers. Details are on the shared page.
What other processes can see
Tokens are not passed as arguments, but message text is, and it is visible in ps and in shell history (shared page). State files and the background server socket are protected by 0600 file permissions and 0700 directories. config set writes config.json with mode 0600; a file from an earlier version can stay 0644 until it is rewritten, and max doctor names such a file and the chmod command that fixes it. Check permissions separately when moving files or redirecting output.
Network destinations
max personal messages download uses HTTP(S) and ordinary redirects without checking DNS addresses. The command does not prohibit VPNs, proxies or local addresses. Files are limited to 4 GiB; voice audio for transcription to 32 MiB.
max sales bot requests identify themselves as max-cli/<версия>, since MAX already recognizes the bot by token. platform-api2.max.ru uses a Russian Ministry of Digital Development root certificate absent from Node. In Node, max adds it to the trusted certificates for the whole process: after the first bot request, every TLS connection in that max invocation trusts it, not only Bot API requests. In Bun it is added only for Bot API requests. The system is unchanged.
Personal-account traffic contains no tool name or custom user-agent; the user-agent and device description come from the MAX web client. Frames use its address, binary format and compression. max personal serve mimics hidden-tab telemetry: one “chat list shown” event 20 seconds after login, containing only account ID and time, never messages or chat titles. One-off commands send no telemetry. After login, max personal serve requests the same kinds of data as the web tab: folders, banners, call history, sticker and reaction sets, and the profile cards and online status of direct-chat contacts. After the first login it also requests stories, missing folder chats and the next chat-list page. These are read requests; the responses are neither displayed nor stored. One-shot commands do not make them. Differences remain: max does not subscribe to push notifications or request animated emoji. The web tab chooses requests using its browser cache, which max does not have, so request counts differ. MAX can distinguish max from its web client.
MAX rules and your account
max is not an official MAX app. The MAX user agreement, revision dated September 9, 2026, section 4.3.7, disallows automated programs without company permission. An account used with max may therefore be restricted; it may also be linked to government services and family communications.
Recommended practices:
- Use MAX normally in a browser or on your phone alongside
max. An account that only answersmaxrequests looks different from one used by a person. - Do not turn
maxinto a continuous stream of requests. Read when needed, rather than every minute on a schedule.
The same notice appears once on stderr when a profile first logs in through max personal setup or max personal session start.
Browser login
session start qr-chrome and sms launch a browser with a temporary profile, separate from your saved passwords and cookies. It contains a logged-in web.max.ru session, so the directory is removed on every exit: success, window closure, --timeout or Ctrl-C. The token is read through a debugging pipe between the processes (--remote-debugging-pipe), without a network port other users could connect to.
session start qr draws a QR code in the terminal. It remains in scrollback but expires after a few minutes. In a narrow terminal, the code appears on a 127.0.0.1 page with a random path. Its URL is neither written to a file nor printed as text. The page disappears when the command exits.
Each login adds a device to the MAX app's session list. You can end it there.
Unofficial protocol
MAX does not publish an API for user accounts. Everything that is known about the protocol here was either measured on a live connection, or read in someone else’s reverse engineering - and for each operation it is written down exactly where it came from (protocol description, column “Where it came from”).
This can stop working without warning. If it does, the command reports it on stderr instead of quietly returning an empty list.
Personal use
The tool stores other people’s conversations and contacts on your computer, including message text. Access to the local database gives access to this data. Sharing a max personal store export file also shares the conversation contents; photo links in it may open without login. Before sharing, check the contents and intended recipients. This page describes how the tool works and does not certify legal compliance for your use case.
A problem report (max personal doctor reports create) is attached to a public GitHub issue. It contains no message text, names or phone numbers; chat and message IDs are replaced with labels. Open and inspect the file before submitting it.
If a token leaks
max personal session end # выйти из MAX и забыть локальноsession end ends this session on the MAX server, making a leaked token stop working. If MAX does not respond, the command reports it and keeps the token; retry the command.
max personal account sessions end --others --yes ends every other session, including your phone app, which will require login again. Ending one session is unsupported because MAX provides no session ID. If MAX rotates this session's token in response, max saves it to the keyring before reporting success.
Next steps
- General Security Page: what is the same in
maxandtg, and how to report a vulnerability - Diagnostics: what exactly is recorded and what is never recorded
- login, sessions and profiles: keyring,
MAX_TOKEN, whatsession enddoes - MCP: what the agent can do via the MCP server and what each flag turns on
- Permissions: how to configure
permissionsandsends_per_hour