RV64 Linux ELF loader reuses the same AT_RANDOM bytes for every process

Đang mở Phù hợp với người mới
#1,692 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@carlosqwqqwq đang làm issue này rồi.

Từ ngày 23/11/2026.

  • #1693 của @carlosqwqqwq — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
64/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
linux, python
Lĩnh vực
operating-systems

Hướng nghiên cứu

Tìm trong mã nguồn Qiling phần thiết lập auxiliary-vector và literal 'a' * 16; Linux ELF loader là điểm vào, và bản sửa thuộc về nơi AT_RANDOM nhận con trỏ của nó. Build probe.elf như mô tả, chạy vòng lặp Python, và so sánh các đầu ra 16 byte lặp lại; QEMU user output là tham chiếu. Hoàn thành nghĩa là mỗi lần khởi chạy Qiling tạo ra một seed 16 byte khác nhau trong khi phần còn lại của bố cục auxv vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
6.2k
Fork
809
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của qilingframework/qiling

Tất cả issue của qilingframework/qiling

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.