A complete, 100% pure Python reverse-engineering implementation of TikTok's latest X-Mssdk-Info telemetry & device fingerprinting header (found in TikTok webmssdk_ex.js and recent web endpoints).

Zero External Dependencies: Operates natively in standard Python 3. No Node.js, MiniRacer, V8 runtime, JSDOM, or headless browser automation required.


Overview: What is X-Mssdk-Info?

X-Mssdk-Info is an anti-bot telemetry header generated by TikTok's client-side security SDK (webmssdk.js). It is sent alongside requests to sensitive endpoints such as:

  • /web/common (Device registration / msToken generation)
  • /node/report/reasons & /node/report/commit (Feedback & report endpoints)
  • /api/comment/list/ & /api/post/item_list/
  • Passport & authentication flows

The header contains a cryptographic snapshot of the client's execution environment (hardware concurrency, WebGL renderer and extensions, screen resolution, browser plugins, and runtime flags). If this header is missing or contains invalid XXTEA ciphertext, TikTok's backend assigns a low trust score, resulting in silent drops, missing items, or CAPTCHA challenges.


Differences: X-Mssdk-Info vs X-Gnarly / X-Dynosaur

Header Role Algorithm Key Structure
X-Mssdk-Info Environment & Fingerprint Telemetry XXTEA (delta 0x9E3779B9, rounds 6 + 52/n) 4-byte random ASCII seed prepended to the output
X-Gnarly Request Signature (Query + Body + UA) ChaCha20 (12-word key, variable rounds 5-20) + KeyMix 48-byte key embedded at dynamic offset inside payload
X-Dynosaur Device Hardware Signature ChaCha20 + Bit-packed TLV payload 48-byte key + 0x3c prefix

Cryptographic Architecture

The generation and decryption pipeline follows these steps:

[ Plaintext JSON Telemetry ]
           │
           â–¼
[ Little-Endian Word Packing (u[832]) ] ──► Appends original byte length as trailing word
           │
           â–¼
[ XXTEA Encryption (delta = 0x9E3779B9, key = seed4) ]
           │
           â–¼
[ Base64 Encoding (Standard or Permuted) ]
           │
           â–¼
[ Output: seed4 + Base64(Ciphertext) ]  ──► (e.g. "spumfIAqFDda4orXE2...")
  1. Key Derivation: The client generates a 4-byte random ASCII seed (e.g. "spum", "BwUV"). The seed is unpacked into little-endian 32-bit words and zero-padded to 4 words (16 bytes).
  2. Payload Serialization: JSON telemetry is serialized with compact separators (",", ":") and packed into little-endian 32-bit integers. The original payload length is appended as the last word.
  3. XXTEA Round Calculation: Encryption runs for $R = 6 + \lfloor 52 / n \rfloor$ rounds where $n$ is the word count.
  4. Header Construction: The 4-byte seed is prepended directly to the Base64 ciphertext so the TikTok backend can decrypt and evaluate the client environment.

Payload Structure (Decrypted Telemetry)

A decrypted X-Mssdk-Info payload (decrypted.json) contains the following sections:

{
  "navigator": {
    "appCodeName": "Mozilla",
    "appName": "Netscape",
    "platform": "Win32",
    "product": "Gecko",
    "productSub": "20030107",
    "hardwareConcurrency": 16,
    "cpuClass": false,
    "maxTouchPoints": 0,
    "oscpu": false,
    "vendor": "Google Inc.",
    "vendorSub": "",
    "doNotTrack": false,
    "vibrate": true,
    "credentials": true,
    "storage": true,
    "requestMediaKeySystemAccess": true,
    "bluetooth": true
  },
  "window": {
    "Image": true,
    "innerHeight": 720,
    "innerWidth": 1280,
    "screenX": 10,
    "screenY": 10,
    "isSecureContext": true,
    "devicePixelRatio": 1.0,
    "toolbar": true,
    "locationbar": true,
    "ActiveXObject": false,
    "external": true,
    "mozRTCPeerConnection": false,
    "postMessage": true,
    "webkitRequestAnimationFrame": true,
    "BluetoothUUID": true,
    "netscape": false
  },
  "document": {
    "characterSet": "UTF-8",
    "compatMode": "CSS1Compat",
    "documentMode": false,
    "layers": false,
    "images": true,
    "location": "www.tiktok.com"
  },
  "webgl": {
    "supportedExtensions": [
      "ANGLE_instanced_arrays",
      "EXT_blend_minmax",
      "EXT_clip_control",
      "EXT_color_buffer_half_float",
      "EXT_depth_clamp",
      "EXT_disjoint_timer_query",
      "EXT_float_blend",
      "EXT_frag_depth",
      "EXT_polygon_offset_clamp",
      "EXT_shader_texture_lod",
      "EXT_texture_compression_bptc",
      "EXT_texture_compression_rgtc",
      "EXT_texture_filter_anisotropic",
      "EXT_texture_mirror_clamp_to_edge",
      "EXT_sRGB",
      "KHR_parallel_shader_compile",
      "OES_element_index_uint",
      "OES_fbo_render_mipmap",
      "OES_standard_derivatives",
      "OES_texture_float",
      "OES_texture_float_linear",
      "OES_texture_half_float",
      "OES_texture_half_float_linear",
      "OES_vertex_array_object",
      "WEBGL_blend_func_extended",
      "WEBGL_color_buffer_float",
      "WEBGL_compressed_texture_s3tc",
      "WEBGL_compressed_texture_s3tc_srgb",
      "WEBGL_debug_renderer_info",
      "WEBGL_debug_shaders",
      "WEBGL_depth_texture",
      "WEBGL_draw_buffers"
    ],
    "antialias": true,
    "blueBits": 8,
    "depthBits": 24,
    "greenBits": 8,
    "maxAnisotropy": 16,
    "maxCombinedTextureImageUnits": 32,
    "maxCubeMapTextureSize": 16384,
    "maxFragmentUniformVectors": 1024,
    "maxRenderbufferSize": 16384,
    "maxTextureImageUnits": 16,
    "maxTextureSize": 16384,
    "maxVaryingVectors": 30,
    "maxVertexAttribs": 16,
    "maxVertexTextureImageUnits": 16,
    "maxVertexUniformVectors": 4096,
    "maxViewportDims": [32767, 32767],
    "redBits": 8,
    "renderer": "WebKit WebGL",
    "vendor": "WebKit",
    "version": "WebGL 1.0 (OpenGL ES 2.0 Chromium)"
  },
  "gpu": "Google Inc. (AMD)/ANGLE (AMD, AMD Radeon(TM) Graphics (0x0000164E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
  "plugins": "PDF Viewerinternal-pdf-viewerapplication/pdftext/pdf##Chrome PDF Viewerinternal-pdf-viewerapplication/pdftext/pdf",
  "timestamp": 1787597800696
}

Repository Structure

tiktok-msddk-info-fully-reversed/
|-- README.md                  # Comprehensive technical documentation
|-- x_mssdk_info.py            # Pure Python generator for X-Mssdk-Info
|-- x_mssdk_info_decrypter.py  # Pure Python decrypter tool (dumps to decrypted.json)
|-- example_usage.py           # Example script (generation + round-trip + request)
|-- decrypted.json             # Sample decrypted authentic TikTok payload
\-- requirements.txt           # Requirements (standard library only)

Quick Start & Installation

No third-party packages are required:

git clone https://github.com/n1tr00-10/tiktok-msddk-info-fully-reversed.git
cd tiktok-msddk-info-fully-reversed
python example_usage.py

Usage Examples

1. Generating X-Mssdk-Info

from x_mssdk_info import get_X_Mssdk_Info

# 1. Standard generation (default Chrome/Win fingerprint + random seed)
token = get_X_Mssdk_Info()
print("X-Mssdk-Info:", token)

# 2. Custom fingerprint matching your request's User-Agent and display resolution
custom_fp = {
    "navigator": {
        "hardwareConcurrency": 8,
        "platform": "Win32"
    },
    "window": {
        "innerWidth": 1920,
        "innerHeight": 1080
    }
}
custom_token = get_X_Mssdk_Info(
    fingerprint=custom_fp,
    user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36..."
)

2. Decrypting X-Mssdk-Info

from x_mssdk_info_decrypter import decrypt_x_mssdk_info

token = "spumfIAqFDda4orXE2PVaJz4dcHeGo5s+1KBzgF21DOn..."
data, seed = decrypt_x_mssdk_info(token)

print("Key Seed:", seed)
print("Timestamp:", data["timestamp"])
print("GPU Info:", data["gpu"])

Or via CLI:

python x_mssdk_info_decrypter.py "<token>"

Disclaimer

This project is intended strictly for educational, security research, and interoperability purposes. All trademarks belong to their respective owners.