某英 浏览器注册验证学习


## 地址

    path = '/platform-telemetry/li/apfcDf'
    headers = {
    'accept': '*/*',
    'accept-language': 'zh-CN,zh;q=0.9',
    'content-encoding': 'gzip',
    'content-type': 'text/plain;charset=UTF-8',
    'cookie': '',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37',
    }
    data = {
        "a":"uEq/yr8mLinAFFm1ub/EAA==",
        "b":"PIAmfj9Qdkj6JkF2APPQuqePFL68ww1OnbsPA2Aa+IzeiMezWfOQSRhdU2RxQkEMrZpLHvSDlfddM9WDQ91FwQ/5NmxlAjefitP1P8XrABD2uTn9lReYuoRVxddAY7WclU+zOaO671x+vN3Vbj2DOYm1KQnYpyWxQAtc3YNIm2/5kH6u14D87jym6fskZPfVG5yOkU/sxuBPsnvqeyb7XRpEKNNcXcmFGVRWPDXhtYBo2BnOJxvKE532q5Eo9ViZNFlM7BIx0EZaLCcqXNTZdo1WCpCAvCR9SpjZXoEBk/dEEQ7lAgmEpDqF4DK3K23gstENx9V36+/KUUbZyPEzgg==",
        "c":"I9f8Tc6zX8NfB3Oyfb9AO+3cnHDvTShpXvVvkXSbRmNosIGcRWzd8w8+oAgd95ls79asF8qhI7GWhWUImBLdEDK97tKleJRmbbltdqDY1ZXOXZmSJtJl6eYMHtOGPA+bPGijsg1dm3eha2ocIrlzU7qKChSWW+JJ+JIl8m4GsMiOe3Eok6eEoPTfPv8vi6kmrT8755bVbam+tCbaue4nhZvQvnZ3len7GHglGYU+VErw9aBLywtzr1HghtEp87NhPWjlJytZV7lS3qR0OogxPR9UEZfIPHYo0roWP2nlNaH/a9BjAf4Belgh/aJ4Zdx6vLiY75RWKnC/uMKv7qgcOlRMi1nXXXX",
        "d":48253773,
        "e":2
    }

## 具体分析:

    分析请求的调用栈(Initator), 定位构造位置;
    初步定位在'https://static.licdn.com/aero-v1/sc/h/eh08muqvrde4h3hc6koyij5ti'返回的JS文件中。
    在指定调用位置设置断点, 调试, 定位生成位置

## 加密逻辑还原


    // str2ab
    function str2ab(e) {
    for (var t = new ArrayBuffer(e["length"]), n = new Uint8Array(t), r = 0, i = e["length"]; r < i; r++) n[r] = e.charCodeAt(r);
    return t
    }
    
    // encode
    function __encoder(e) {
    return window.btoa(String['fromCharCode']['apply'](null, e))
    }
    
    // 0x222
    function x_222(e, t, n) {
    var r = window['atob'](t), i = str2ab(r);
    return window['crypto']['subtle']['importKey'](e, i, {
    name: 'RSA-OAEP', hash: 'SHA-256'
    }, !0, n)
    }
    
    // 0x229
    function x_229(e, t) {
    return x_222('spki', t, ['wrapKey']).then((function (key) {
    return window['crypto']['subtle'].wrapKey("raw", e, key, {"name": "RSA-OAEP"})
    })).then((function (e) {
    return __encoder(new Uint8Array(e))
    }))
    
    }
    
    // 0x22d
    function x_22d(e, t, n) {
    var i = Date.now();
    var r = {
    a: null, b: null, c: null
    };
    var iv = window.crypto.getRandomValues(new Uint8Array(16))
    r.a = __encoder(iv);
    var encrypt_data = (new TextEncoder).encode(e)
    window.crypto.subtle.generateKey({
    name: 'AES-CBC', length: 256,
    }, !0, ["encrypt", "decrypt"]).then((function (key) {
    return window.crypto.subtle.encrypt({
    name: 'AES-CBC', iv: iv,
    }, key, encrypt_data).then(function (a) {
    return x_229(key, t).then((function (e) {
    r.b = e, r.c = __encoder(new Uint8Array(a)), r.d = Date.now() - i, r.e = n, r
    console.log('r:', r, 'r.b:::', r.b)
    }))
    })
    }))
    
    }
    
    const e = '{"latency":{"acq_time":{"appName":0,"tsSeed":0,"appVersion":0,"appCodeName":0,"location":0,"javascripts":0,"platform":1,"product":0,"productSub":0,"cpuClass":0,"oscpu":0,"numOfCores":0,"deviceMemory":0,"vendor":0,"vendorSub":0,"language":0,"timezoneOffset":0,"timezone":0,"userAgent":0,"webdriver":1,"colorDepth":0,"pixelDepth":0,"screenResolution":1,"screenOrientation":0,"availableScreenResolution":0,"sessionStorage":0,"localStorage":0,"indexedDb":0,"addBehavior":0,"openDatabase":0,"canvas":39,"webgl":61,"signals":1,"touchSupport":0,"networkInfo":0,"automation":0,"plugins":1,"mimetyps":0,"fonts":20,"allFeatures":131}},"errors":{},"appName":"Netscape","tsSeed":1723626778012,"appVersion":"5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37","appCodeName":"Mozilla","location":{"hash":"n/a","host":"www.linkedin.com","hostname":"www.linkedin.com","href":"https://www.linkedin.com/","origin":"https://www.linkedin.com","pathname":"/","port":"n/a","protocol":"https:"},"javascripts":[],"platform":"MacIntel","product":"Gecko","productSub":"20030107","cpuClass":"n/a","oscpu":"n/a","numOfCores":8,"deviceMemory":"8 GB","vendor":"Google Inc.","vendorSub":"n/a","language":"zh-CN","timezoneOffset":-8,"timezone":"Asia/Shanghai","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37","webdriver":"n/a","colorDepth":24,"pixelDepth":24,"screenResolution":{"w":1280,"h":720},"screenOrientation":{"Enabled":true,"Orientation":"landscape-primary"},"availableScreenResolution":{"w":1280,"h":720},"sessionStorage":true,"localStorage":true,"indexedDb":true,"addBehavior":false,"openDatabase":true,"canvas":{"canvasWinding":"yes","canvasHash":"e100529ced93b21d8222cf8c06c2e987"},"webgl":{"webglHash":"76a350f48c3105d3303eeec6f5a76c01","vendorAndRenderer":"Google Inc. (Intel Inc.)~ANGLE (Intel Inc., Intel(R) Iris(TM) Plus Graphics OpenGL Engine, OpenGL 4.1)","extensions":["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_float_blend","EXT_frag_depth","EXT_shader_texture_lod","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","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_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","WEBGL_lose_context","WEBGL_multi_draw"],"webgl aliased line width range":"[1, 1]","webgl aliased point size range":"[1, 255.875]","webgl alpha bits":8,"webgl antialiasing":"yes","webgl blue bits":8,"webgl depth bits":24,"webgl green bits":8,"webgl max anisotropy":16,"webgl max combined texture image units":32,"webgl max cube map texture size":16384,"webgl max fragment uniform vectors":1024,"webgl max render buffer size":16384,"webgl max texture image units":16,"webgl max texture size":16384,"webgl max varying vectors":15,"webgl max vertex attribs":16,"webgl max vertex texture image units":16,"webgl max vertex uniform vectors":1024,"webgl max viewport dims":"[16384, 16384]","webgl red bits":8,"webgl renderer":"WebKit WebGL","webgl shading language version":"WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)","webgl stencil bits":0,"webgl vendor":"WebKit","webgl version":"WebGL 1.0 (OpenGL ES 2.0 Chromium)","webgl unmasked vendor":"Google Inc. (Intel Inc.)","webgl unmasked renderer":"ANGLE (Intel Inc., Intel(R) Iris(TM) Plus Graphics OpenGL Engine, OpenGL 4.1)","webgl vertex shader high float precision":23,"webgl vertex shader high float precision rangeMin":127,"webgl vertex shader high float precision rangeMax":127,"webgl vertex shader medium float precision":23,"webgl vertex shader medium float precision rangeMin":127,"webgl vertex shader medium float precision rangeMax":127,"webgl vertex shader low float precision":23,"webgl vertex shader low float precision rangeMin":127,"webgl vertex shader low float precision rangeMax":127,"webgl fragment shader high float precision":23,"webgl fragment shader high float precision rangeMin":127,"webgl fragment shader high float precision rangeMax":127,"webgl fragment shader medium float precision":23,"webgl fragment shader medium float precision rangeMin":127,"webgl fragment shader medium float precision rangeMax":127,"webgl fragment shader low float precision":23,"webgl fragment shader low float precision rangeMin":127,"webgl fragment shader low float precision rangeMax":127,"webgl vertex shader high int precision":0,"webgl vertex shader high int precision rangeMin":31,"webgl vertex shader high int precision rangeMax":30,"webgl vertex shader medium int precision":0,"webgl vertex shader medium int precision rangeMin":31,"webgl vertex shader medium int precision rangeMax":30,"webgl vertex shader low int precision":0,"webgl vertex shader low int precision rangeMin":31,"webgl vertex shader low int precision rangeMax":30,"webgl fragment shader high int precision":0,"webgl fragment shader high int precision rangeMin":31,"webgl fragment shader high int precision rangeMax":30,"webgl fragment shader medium int precision":0,"webgl fragment shader medium int precision rangeMin":31,"webgl fragment shader medium int precision rangeMax":30,"webgl fragment shader low int precision":0,"webgl fragment shader low int precision rangeMin":31,"webgl fragment shader low int precision rangeMax":30},"signals":{"adBlockInstalled":false,"liedLanguages":false,"liedResolution":false,"liedOS":true,"liedBrowser":false},"touchSupport":{"maxTouchPoints":0,"touchEvent":false,"touchStart":false},"networkInfo":{"downlink":1.75,"effectiveType":"4g","rtt":200,"saveData":false},"automation":"n/a","plugins":[["Chrome PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Chromium PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["Microsoft Edge PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["PDF Viewer","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]],["WebKit built-in PDF","Portable Document Format",[["application/pdf","pdf"],["text/pdf","pdf"]]]],"mimetyps":[{"type":"application/pdf","suffixes":"pdf","description":"Portable Document Format"},{"type":"text/pdf","suffixes":"pdf","description":"Portable Document Format"}],"fonts":{"fontsHash":"cb22f3c49634a3cbceb06671e4758fa8","lists":["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Comic Sans MS","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","LUCIDA GRANDE","Microsoft Sans Serif","Monaco","Palatino","Tahoma","Times","Times New Roman","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"]},"reqid":"d8c03414-ab20-41d5-8d4c-ca2065552b83","pageInstance":"urn:li:page:d_homepage-guest-home_jsbeacon;BTJ1GFbOSTm2BSf4Nd6e+A==","fullFeatureCollection":false}'
    const t = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqyVTa3Pi5twlDxHc34nl3MlTHOweIenIid6hDqVlh5/wcHzIxvB9nZjObW3HWfwqejGM+n2ZGbo9x8R7ByS3/V4qRgAs1z4aB6F5+HcXsx8uVrQfwigK0+u7d3g1s7H8qUaguMPHxNnyj5EisTJBh2jf9ODp8TpWnhAQHCCSZcDM4JIoIlsVdGmv+dGlzZzmf1if26U4KJqFdrqS83r3nGWcEpXWiQB+mx/EX4brbrhOFCvfPovvsLEjMTm0UC68Bvki3UsB/vkkMPW9cxNiiJJdnDkOEEdQPuFmPug+sqhACl3IIHLVBFM7vO0ca14rcCNSbSDaaKOY6BQoW1A30wIDAQAB'
    const n = 2
    x_22d(e, t, n)
    

## 加密流程整理
    
    通过分析我们了解到:
    1. 生成密钥: window.crypto.subtle.generateKey生成AES-CBC加密密钥;
    2. 生成iv: window.crypto.getRandomValues(new Uint8Array(16));
    3. 加密数据: 使用window.crypto.subtle.encrypt对明文进行加密;
    4. 对密钥进行加密 通过window.crypto.subtle.wrapKey方法,使用RSA-OAEP算法对AES-CBC的密钥进行加密;
    5. 最终将结果r进行返回

    结果解析:
    const r = {
        "a":"uEq/yr8mLinAFFm1ub/EAA==",
        "b":"PIAmfj9Qdkj6JkF2APPQuqePFL68ww1OnbsPA2Aa+IzeiMezWfOQSRhdU2RxQkEMrZpLHvSDlfddM9WDQ91FwQ/5NmxlAjefitP1P8XrABD2uTn9lReYuoRVxddAY7WclU+zOaO671x+vN3Vbj2DOYm1KQnYpyWxQAtc3YNIm2/5kH6u14D87jym6fskZPfVG5yOkU/sxuBPsnvqeyb7XRpEKNNcXcmFGVRWPDXhtYBo2BnOJxvKE532q5Eo9ViZNFlM7BIx0EZaLCcqXNTZdo1WCpCAvCR9SpjZXoEBk/dEEQ7lAgmEpDqF4DK3K23gstENx9V36+/KUUbZyPEzgg==",
        "c":"I9f8Tc6zX8NfB3Oyfb9AO+3cnHDvTShpXvVvkXSbRmNosIGcRWzd8w8+oAgd95ls79asF8qhI7GWhWUImBLdEDK97tKleJRmbbltdqDY1ZXOXZmSJtJl6eYMHtOGPA+bPGijsg1dm3eha2ocIrlzU7qKChSWW+JJ+JIl8m4GsMiOe3Eok6eEoPTfPv8vi6kmrT8755bVbam+tCbaue4nhZvQvnZ3len7GHglGYU+VErw9aBLywtzr1HghtEp87NhPWjlJytZV7lS3qR0OogxPR9UEZfIPHYo0roWP2nlNaH/a9BjAf4Belgh/aJ4Zdx6vLiY75RWKnC/uMKv7qgcOlRMi1nXXXX",
        "d":48253773,
        "e":2
    }
    // r.a: 变形后的AEC-CBC iv 
    // r.b: 通过RSA-OAEP加密的密钥
    // r.c: 通过AEC-CBC 加密的原文
    // r.d: 花费时间
    // r.e: 固定值


## 总结

    首先生成AES-CBC对称加密算法的key, iv, 通过AES-CBC加密算法对明文内容进行加密;
    然后使用RSA-OAEP非对称加密算法对key进行包装, 并将返回值与其他结果一同回传;
    服务端接收到请求内容后, 可以通过私钥对包装后的key进行解密,然后通过key、iv对加密数据进行解密校验。
    该套加密方法可以在数据传输过程中防止文件篡改、数据泄漏等功能。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值