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

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

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

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

工具目录

分类

查看所有分类
Loading categories
GoTEE-example — GoTEE - example application | Kitploit
工具/GitHubGitHub/usbarmory/gotee-example
Embedded Systems SecurityMemory ForensicsDebuggersSecurity VirtualizationHardware Security
GitHubusbarmory/gotee-example

GoTEE-example

GoTEE - example application

查看仓库
1754个月前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

引言

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

凭借这些能力,GoTEE 实现了基于 TamaGo 的可信执行环境(TEE),将 Go 的内存安全性、便利性和能力引入到 ARM TrustZone 安全世界或 RISC-V Supervisor 执行环境中的裸机执行。

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

特性

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

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

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

文档

Go Reference

包含教程的主要文档可在项目 wiki 中找到。

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

支持的硬件

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

示例应用

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

GoTEE 示例 演示了作为可信 OS、可信 Applet 和主 OS 运行的 Go unikernel 的并发操作。

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

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

该示例可信 OS/Applet 组合对三个在不同特权级别下并发执行的 TamaGo unikernel 进行基本测试:

  • 可信 OS(ARM:TZ 安全世界系统模式,RISC-V:M 模式)
  • 可信 Applet(ARM:TZ 安全世界用户模式,RISC-V:S 模式)
  • 主 OS(ARM:TZ 普通世界系统模式,RISC-V:S 模式)

主 OS 通过监视器调用让出(yields back)。

可信 Applet 先休眠 5 秒,然后尝试读取可信 OS 内存,这会触发由监管者处理的异常,并终止该可信 Applet。

GoTEE 系统调用 接口用于可信 OS 与可信 Applet 之间的通信。

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

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 命令启动,该命令会生成主 OS 两次,以演示在真实硬件外设上 TrustZone 限制生效前后的行为。

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

[!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 编译器 由 Makefile 自动下载并编译为 go tool。

或者,可以覆盖 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 目标上构建与执行

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

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 目标上构建与执行

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

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