RV64 Linux ELF loader reuses the same AT_RANDOM bytes for every process
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 64/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- linux, python
调研方向
在 Qiling 源码中搜索 auxiliary-vector 设置和字面量 'a' * 16;Linux ELF loader 是入口点,修复应位于 AT_RANDOM 接收其指针的位置。按描述构建 probe.elf,运行 Python 循环,并比较重复的 16 字节输出;QEMU user output 是参照。完成意味着每次启动 Qiling 都会产生不同的 16 字节种子,同时 auxv 布局的其余部分仍然正常工作。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
A static RV64 Linux ELF that reads the 16 bytes referenced by auxiliary-vector entry AT_RANDOM receives the same bytes on every Qiling launch. On the current dev branch, the loader builds this buffer from the literal 'a' * 16.
Sample Code
Save as probe.S:
.option push
.option norelax
.section .text
.globl _start
_start:
ld t0, 0(sp)
addi t1, sp, 8
slli t2, t0, 3
add t1, t1, t2
addi t1, t1, 8
.Lskip_env:
ld t3, 0(t1)
beqz t3, .Lenv_end
addi t1, t1, 8
j .Lskip_env
.Lenv_end:
addi t1, t1, 8
li t5, 25
.Lauxv:
ld t3, 0(t1)
beqz t3, .Lnot_found
ld t4, 8(t1)
beq t3, t5, .Lfound
addi t1, t1, 16
j .Lauxv
.Lfound:
li a0, 1
mv a1, t4
li a2, 16
li a7, 64
ecall
li a0, 0
li a7, 93
ecall
.Lnot_found:
li a0, 2
li a7, 93
ecall
.option pop
Expected behavior
AT_RANDOM should point to 16 process-specific random bytes. Repeated launches should not all return the fixed sequence 61 repeated 16 times.
Reproduction
With a RISC-V cross-binutils toolchain and QEMU user emulator installed:
riscv64-linux-gnu-as -march=rv64imac -mabi=lp64 -o probe.o probe.S
riscv64-linux-gnu-ld -m elf64lriscv -static -e _start -o probe.elf probe.o
for i in 1 2 3; do qemu-riscv64 ./probe.elf | od -An -tx1; done
From an installed checkout of Qiling dev, run:
from qiling import Qiling
from qiling.const import QL_ARCH, QL_OS, QL_VERBOSE
for _ in range(3):
ql = Qiling(["./probe.elf"], ".", archtype=QL_ARCH.RISCV64,
ostype=QL_OS.LINUX, verbose=QL_VERBOSE.DISABLED)
ql.run()
Qiling prints the same 16-byte 0x61 sequence on each run; QEMU user returns different 16-byte values.
Additional context
Linux uses AT_RANDOM as a process-specific seed in the initial ELF stack. This report is limited to the guest-visible bytes and does not claim a particular exploit.
References: Linux ELF loader · QEMU user ELF loader
- 主要语言
- Python
- 星标
- 6.2k
- 派生
- 809
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
qilingframework/qiling 的其他 Issue
-
[RISC-V/Linux] uname reports ql_processor instead of riscv64可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
qilingframework/qiling#1690 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
qilingframework/qiling#1689 ·
-
[RISC-V/Linux] fstatfs succeeds for an invalid file descriptor可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
qilingframework/qiling#1688 ·
-
[Linux/RISC-V64] pread64 on an O_WRONLY descriptor returns EPERM instead of EBADF可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
qilingframework/qiling#1686 ·
-
难度 2/5 半天 新手友好度 82/100
qilingframework/qiling#1640 ·
查看 qilingframework/qiling 的全部 Issue
相似的 Issue
-
flaky: test_fire_returns_thread_per_http_entry_on_head waits 5 s per dispatch worker on busy shards未关闭status/accepted type/bug
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bug vector-store
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
EverMind-AI/Raven#1413 ·
维护者通常 1 天内回复
-
Tests: parallel pyinstallcheck runs oversubscribe the machine through nested TBB and BLAS pools可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
ACCESS-NRI/containerised-environments-infra#143 ·
维护者通常 2 天内回复