技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度技术分析:vah13/extractTVpasswords

项目背景与痛点

TeamViewer 是一款广泛使用的远程桌面软件,它在企业和个人用户中有着极高的需求量。然而,企业通常会关心如何保护 TeamViewer 的登录凭证,特别是在受到内存攻击的情况下。vah13/extractTVpasswords 项目的核心目标是通过 Frida 工具从 TeamViewer 内存中提取密码。这是对现有安全实践的一种补充,特别是对于那些需要深入检查系统内存的高级安全分析场景。

核心技术揭秘

架构与实现原理

vah13/extractTVpasswords 使用 Frida 进行内存操作,Frida 是一个动态代码注入工具,可以用于对正在运行中的应用程序进行逆向工程和分析。该项目通过 Frida 动态注入代码,针对 TeamViewer 的内存空间进行监控和提取密码数据。

graph TD A[用户执行脚本] --> B[Frida 注入代码] B --> C{"是否检测到密码?"} C -->|"是"| D[提取并显示密码] C -->|"否"| E[继续监控]

在代码层面,该项目主要是通过 Frida 提供的 API 对 TeamViewer 进程内存进行监控。开发者可以依靠 Frida 的 hook 能力来监控敏感的内存区域,比如用来存储密码的字符串。此外,它还通过某些签名或特定的内存布局来识别这些敏感数据,因此项目中涉及的字符串分析和内存操作处理也是一个关键的技术点。

代码实现分析示例

import frida

## 定义 TeamViewer 进程名(不同系统可能有所不同)
app_name = 'TeamViewer.exe'

## 开始注入
session = frida.attach(app_name)

## 写入的注入脚本
script = session.create_script("""
Interceptor.attach(ptr("目标地址"), {
    onEnter: function(args) {
        console.log("提取到了密码: " + Memory.readUtf8String(args[0]));
    }
});
""")

## 加载脚本
script.load()

通过上述代码,项目实现了在目标进程内存操作中的动态注入以及数据的提取与显示,这为高级用户提供了安全分析的重要工具。

功能亮点与差异

vah13/extractTVpasswords 的独特之处在于其利用 Frida 工具进行动态内存操作的能力。与其他仅提供静态分析的工具相比,该项技术能够更真实地还原应用程序运行时的内存状态,这对于深入分析内存中的敏感数据(如密码)具有重要意义。

应用场景与落地建议

虽然这个工具可以帮助开发者和安全研究人员了解系统内存中的数据,但是使用它可能会带来不同的安全风险。在生产环境中,建议将其用于受控测试环境,避免直接在生产系统上使用。特别需要注意的是:

  • 确保在权限控制下使用 Frida,避免出现未经许可的数据泄露。
  • 仅在需要的特定场景下使用该工具,以减少不必要的风险。
  • 评估并确认所提取的数据仅用于合法的安全测试或审计用途。

综合评价

优点:

  • 功力强大:通过动态代码注入可以直接获取 TeamViewer 内存中的数据。
  • 适用性强:适合需要深入分析系统内存的场景。
  • 开源性:方便其他开发者基于该项目进行二次开发。

缺点:

  • 安全风险:在生产环境使用可能带来数据泄露的风险。
  • 依赖性:高度依赖 Frida 和 TeamViewer 内存布局等外部环境和条件。

关于

GitHub 原始描述(英文)

tool to extract passwords from TeamViewer memory using Frida

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
724
价值分
316
活跃状态
活跃

语言占比

C++
Python

README

Extract password from TeamViewer memory using Frida (CVE-2018-14333)

  Hi there, in this article we want to tell about our little research about password security in TeamViewer. The method can help during the pentest time for post exploitation to get access to another machine using TeamViewer.

TeamViewer automatically authentication

  A few days ago I worked on my windows cloud VPS with TeamViewer (where I set a custom password). After work I disconnected, at the next time when I wanted to connect, I saw that TeamViewer had auto-filled the password.

tw_interface

I think “Interesting, how can i get access to the password? How is the password stored in my computer?”

Password location

I dumped the memory of the TeamViewer and grepped password. dump

Ooo yeees, 😊 password in the memory is stored in Unicode format. It turns out that if you finish work with TeamViewer and don’t kill the process (or exit from TeamViewer

menu

the password will be stored in memory)

  After analyzing we understood that the first red area is a start magic data, in the second one – end magic data (from time to time, end magic data has this value = 00 00 00 20 00 00).

Script for getting password

To extract passwords from memory we wrote two mini programs, in Python and C++ language.

Thx Frida team for a wonderful tool! Our python script attaches to the TeamViewer.exe process, gets the base address and memory size of each library in this process. After that, it dumps one by one memory area, searches parts with [00 88] bytes at the start and [00 00 00] bytes in the end and copies them in the array. The next and the last step is choosing end decoding raws according to the regexp and password policy.

python_work_example

After executing the C++ code, you will get this view “asdQWE123” is the password

cpp_poc

For the future

  1. The programs can extract well remote ID and passwords, but he also gets some false positive dates. If we will have free time, we will try to reduce false positive rates.
  2. Optimize C++ code from https://github.com/vah13/extractTVpasswords
examples

c++ example

cppex

python example

pyex

@NewFranny

@vah_13

评论

暂无评论