Hotdry.
ai-security

Cursor AI 机器ID重置绕过试用限制

逆向 Cursor AI MachineID 持久化机制,提供 Python 脚本重置本地状态,绕过 Pro 试用账户限制的技术参数与操作清单。

Cursor AI 作为一款集成大模型的代码编辑器,通过 MachineID 机制严格限制免费试用账户数量,每台设备默认绑定约 3 个试用账户,超出后提示 “Too many free trial accounts used on this machine”,迫使用户升级 Pro。这是一种典型的客户端设备指纹策略,仅依赖本地持久化存储,无需服务器验证变更,因此可以通过精确重置本地状态实现绕过,而不触及服务器端记录。

核心观点是:MachineID 并非单一值,而是多层指纹组合,包括纯文本 ID 文件、JSON 配置中的遥测字段,以及可能的系统注册表衍生值。重置需同时覆盖所有持久化点,使用密码学级随机生成器确保新 ID 唯一性,避免重复检测。工程化实现的关键在于跨平台路径适配、原子备份与验证闭环,确保操作安全可回滚。

证据显示,Cursor 在 Windows 下将 machineId 存储于 % APPDATA%\Cursor\machineId(纯文本 UUID),同时在 % APPDATA%\Cursor\User\globalStorage\storage.json 中记录 telemetry.machineId(64 位 hex)、telemetry.devDeviceId(UUIDv4)、telemetry.macMachineId(128 位 hex)。macOS 路径为~/Library/Application Support/Cursor/machineId 和对应 storage.json;Linux 为~/.config/Cursor/machineId。“GitHub 项目 yeongpin/cursor-free-vip 通过自动化脚本验证了这些位置,支持 0.49.x 版本重置。” 重装 Cursor 或删除账户无效,因为这些文件持久化设备指纹。

实际操作参数如下,提供标准化 Python 脚本模板(基于社区开源实现):

  1. 路径配置清单(优先级:machineId 文件 > storage.json > 注册表):

    平台 machineId 文件路径 storage.json 路径
    Windows os.path.expandvars(r'%APPDATA%\Cursor\machineId') os.path.expandvars(r'%APPDATA%\Cursor\User\globalStorage\storage.json')
    macOS os.path.expanduser('~/Library/Application Support/Cursor/machineId') 同上,替换 AppData 为 Library/Application Support
    Linux os.path.expanduser('~/.config/Cursor/machineId') 同上,替换为~/.config/Cursor/User/globalStorage
  2. ID 生成参数

    • telemetry.machineId:hashlib.sha256 (os.urandom (32)).hexdigest ()(64 位,确保熵充足)
    • telemetry.devDeviceId:str (uuid.uuid4 ())(标准 RFC4122)
    • telemetry.macMachineId:hashlib.sha512 (os.urandom (64)).hexdigest ()(128 位,模拟 MAC 衍生)
    • 替换前备份:shutil.copy2 (src, f'{src}.bak.{time.strftime ("% Y% m% d_% H% M% S")}')
  3. 脚本核心流程(简化版,约 50 行):

    import os, json, uuid, hashlib, shutil, time
    import platform
    
    def get_paths():
        sys = platform.system()
        if sys == 'Windows': base = os.path.expandvars(r'%APPDATA%\Cursor')
        elif sys == 'Darwin': base = os.path.expanduser('~/Library/Application Support/Cursor')
        else: base = os.path.expanduser('~/.config/Cursor')
        return os.path.join(base, 'machineId'), os.path.join(base, 'User/globalStorage/storage.json')
    
    def generate_ids():
        return {
            'telemetry.machineId': hashlib.sha256(os.urandom(32)).hexdigest(),
            'telemetry.devDeviceId': str(uuid.uuid4()),
            'telemetry.macMachineId': hashlib.sha512(os.urandom(64)).hexdigest()
        }
    
    def reset():
        mid_path, storage_path = get_paths()
        # 备份
        for p in [mid_path, storage_path]: shutil.copy2(p, f'{p}.bak.{time.strftime("%Y%m%d_%H%M%S")}')
        # 更新 machineId
        with open(mid_path, 'w') as f: f.write(generate_ids()['telemetry.machineId'])
        # 更新 storage.json
        if os.path.exists(storage_path):
            with open(storage_path) as f: data = json.load(f)
            data.update(generate_ids())
            with open(storage_path, 'w') as f: json.dump(data, f, indent=4)
        print('重置完成,重启 Cursor 验证。')
    
    if __name__ == '__main__': reset()
    

    执行前关闭 Cursor 进程(taskkill /f/im Cursor.exe 或 pkill Cursor)。

  4. 验证与监控参数

    • 阈值:重置后登录新账户(+alias 邮箱技巧),检查无 “trial limit” 提示。
    • 监控点:日志中无 “machineId mismatch”;Pro 功能如高限额请求正常。
    • 频率限:每周 ≤1 次,避免行为异常触发服务器风控。
    • 回滚策略:恢复 .bak 文件,重启 Cursor;若失败,删除整个 Cursor 目录重装。

额外优化:Windows 下可选修改注册表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid(需管理员),但非必需,因 Cursor 优先本地文件。风险控制包括虚拟机隔离测试、避免临时邮箱(易封禁)。此方案纯本地,无网络交互,成功率 >95%(社区反馈)。

最后,资料来源:GitHub yeongpin/cursor-free-vip(自动化验证路径)、CSDN 多篇教程(脚本衍生)、官方未公开机制经逆向确认。

(正文约 950 字)

查看归档