Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
GoTEE — Go 可信执行环境 (TEE) | Kitploit
工具/GitHubGitHub/usbarmory/gotee
嵌入式系统安全安全虚拟化硬件安全
GitHubusbarmory/gotee

GoTEE

Go 可信执行环境 (TEE)

查看仓库
1521353个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

简介

GoTEE 框架实现了基于 TamaGo 的 unikernel 在特权和非特权模式下的并发实例化,它们通过监控器模式和自定义系统调用相互交互。

凭借这些能力,GoTEE 实现了基于 TamaGo 的可信执行环境(TEE),为 ARM TrustZone 安全世界或 RISC-V 监管者执行环境中的裸机执行带来了 Go 语言的内存安全性、便利性和能力。

GoTEE 可以监管实现了 GoTEE API 的、基于纯 Go、Rust 或 C 的独立式可信小程序(Trusted Applet),以及任何能够在 ARM TrustZone 普通世界或 RISC-V S 模式下运行的操作系统,例如 Linux。

特性

  • 隔离的执行上下文,适用于 ARM 用户模式、TrustZone 普通世界或 RISC-V 监管者模式

  • 用于故障检测的机会性软锁步

  • 用于可信操作系统实现的 API(Syscall、JSON-RPC 和异常处理程序)

文档

Go Reference

主要文档(包括教程)可在项目 wiki上找到。

软件包 API 文档可在 pkg.go.dev 上找到。

支持的硬件

下表总结了当前支持的 SoC 和开发板。

示例应用

在 TEE 术语中,特权 unikernel 通常被称为可信操作系统(Trusted OS),而非特权 unikernel 则代表可信小程序(Trusted Applet)。

GoTEE 示例 演示了分别充当可信操作系统、可信小程序和主操作系统(Main OS)的 Go unikernel 的并发运行。

[!WARNING] 主操作系统可以是任何“富”操作系统(例如 Linux),TamaGo 仅用于提供一个自包含的示例。 可信小程序也是如此,它可以是任何能够在用户模式下运行并实现 GoTEE API 的裸机应用程序, 例如独立式 C 或 Rust 程序。

构建时可以使用 Rust 示例, 将 trusted_applet_go 替换为 trusted_applet_rust。

该示例的可信操作系统/小程序组合对三个 TamaGo unikernel 在不同特权级别下的并发执行进行了基本测试:

  • 可信操作系统(ARM:TZ 安全世界系统模式,RISC-V:M 模式)
  • 可信小程序(ARM:TZ 安全世界用户模式,RISC-V:S 模式)
  • 主操作系统(ARM:TZ 普通世界系统模式,RISC-V:S 模式)

主操作系统通过监控器调用让出执行权。

可信小程序会先休眠 5 秒,然后尝试读取可信操作系统的内存,这会触发由监管者处理的异常,从而终止可信小程序。

GoTEE 的系统调用(syscall)接口用于实现可信操作系统与可信小程序之间的通信。

当在 USB armory Mk II 上启动时,示例应用可通过 SSH 经 USB 以太网(ECM 协议,支持 Linux 和 macOS 主机)访问:

root@kitploit:~
$ ssh [email protected]
tamago/arm • TEE security monitor (Secure World system/monitor)

allgptr                                          # memory forensics of applet goroutines
csl                                              # show config security levels (CSL)
csl             <periph> <slave> <hex csl>       # set config security level (CSL)
dbg                                              # show ARM debug permissions
exit, quit                                       # close session
gotee                                            # TrustZone example w/ TamaGo unikernels
help                                             # this help
linux           <uSD|eMMC>                       # boot NonSecure USB armory Debian base image
lockstep        <fault %>                        # tandem applet example w/ fault injection
peek            <hex offset> <size>              # memory display (use with caution)
poke            <hex offset> <hex value>         # memory write   (use with caution)
reboot                                           # reset device
sa                                               # show security access (SA)
sa              <id> <secure|nonsecure>          # set security access (SA)
stack                                            # stack trace of current goroutine
stackall                                         # stack trace of all goroutines

>

可以使用 gotee 命令启动该示例,该命令会生成两个主操作系统实例,以便使用真实硬件外设展示 TrustZone 限制生效前后的行为。

此外,linux 命令可用于将 USB armory Debian 基础镜像 作为非安全主操作系统启动。

[!NOTE] 仅支持 USB armory Debian 基础镜像 >= 20211129 的版本用于非安全操作。

gotee

该示例也可以在 QEMU 模拟下执行。

[!NOTE] 由于 QEMU 缺少完整的 TrustZone/PMP 支持,模拟运行仅执行部分测试。

root@kitploit:~
make qemu
...
> gotee
00:00:00 tamago/arm • TEE security monitor (Secure World system/monitor)
00:00:00 SM loaded applet addr:0x9c000000 entry:0x9c072740 size:4940275
00:00:00 SM loaded kernel addr:0x80000000 entry:0x8007100c size:4577643
00:00:00 SM waiting for applet and kernel
00:00:00 SM starting mode:USR sp:0x9e000000 pc:0x9c072740 ns:false
00:00:00 SM starting mode:SYS sp:0x00000000 pc:0x8007100c ns:true
00:00:00 tamago/arm (go1.19.1) • TEE user applet
00:00:00 tamago/arm (go1.19.1) • system/supervisor (Non-secure)
00:00:00 supervisor is about to yield back
00:00:00 SM stopped mode:SYS sp:0x8146bf54 lr:0x801937a4 pc:0x80193884 ns:true err:exit
00:00:00 applet obtained 16 random bytes from monitor: b4cc4764dd30291a52545b182313003c
00:00:00 applet requests echo via RPC: hello
00:00:00 applet received echo via RPC: hello
00:00:00 applet will sleep for 5 seconds
00:00:01 applet says 1 mississippi
...
00:00:05 applet says 5 mississippi
00:00:05 applet is about to read secure memory at 0x98010000
00:00:05    r0:98010000  r1:9c8240c0  r2:98010000  r3:00000000
00:00:05    r4:00000000  r5:00000000  r6:00000000  r7:9c86bec8
00:00:05    r8:00000007  r9:0000003d r10:9c8020f0 r11:9c342f41 cpsr:600001d7 (ABT)
00:00:05   r12:00000061  sp:9c86bf08  lr:9c1b1be8  pc:9c011330 spsr:600001d0 (USR)
00:00:05 SM stopped mode:USR sp:0x9c86bf08 lr:0x9c1b1be8 pc:0x9c011330 ns:false err:ABT

构建编译器

构建 TamaGo 编译器(或使用最新的二进制版本):

root@kitploit:~
wget https://github.com/usbarmory/tamago-go/archive/refs/tags/latest.zip
unzip latest.zip
cd tamago-go-latest/src && ./all.bash
cd ../bin && export TAMAGO=`pwd`/go

在 ARM 目标上构建与执行

按如下方式构建示例可信小程序和内核可执行文件:

root@kitploit:~
git clone https://github.com/usbarmory/GoTEE-example
cd GoTEE-example && export TARGET=usbarmory && make nonsecure_os_go && make trusted_applet_go && make trusted_os

[!NOTE] 如需 Rust TA 示例,请将 trusted_applet_go 替换为 trusted_applet_rust, 这需要 Rust nightly 和 armv7a-none-eabi 工具链。

最终的可执行文件生成在 bin 子目录中,trusted_os_usbarmory.imx 应用于本机执行。

可用的目标如下:

TARGET开发板执行与调试
usbarmoryUSB armory Mk IIusbarmory

这些目标支持本机执行(参见上表中相关的文档链接)以及模拟执行(例如 make qemu)。

在 RISC-V 目标上构建与执行

按如下方式构建示例可信小程序和内核可执行文件:

root@kitploit:~
git clone https://github.com/usbarmory/GoTEE-example
cd GoTEE-example && export TARGET=sifive_u && make nonsecure_os_go && make trusted_applet_go && make trusted_os

[!NOTE] 如需 Rust TA 示例,请将 trusted_applet_go 替换为 trusted_applet_rust, 这需要 Rust nightly 和 riscv64gc-unknown-none-elf 工具链。

最终的可执行文件生成在 bin 子目录中。

可用的目标:

TARGET开发板执行与调试
sifive_uQEMU sifive_usifive_u

该目标仅经过模拟执行(例如 make qemu)测试。

使用 GoTEE 的应用

  • ArmoredWitness - 跨生态系统见证网络

作者

Andrea Barisani
[email protected]

Andrej Rosano
[email protected]

许可证

GoTEE | https://github.com/usbarmory/GoTEE
版权所有 (c) GoTEE 作者。保留所有权利。

这些源文件根据 LICENSE 文件中的 BSD 风格许可证分发。

下载工具
SoC开发板SoC 软件包开发板软件包
NXP i.MX6ULZUSB armory Mk IIimx6ulusbarmory/mk2
NXP i.MX6ULLMCIMX6ULL-EVKimx6ulmx6ullevk
SiFive FU540QEMU sifive_ufu540qemu/sifive_u