[Bug] Heap Buffer Overflow in FinSH `msh_auto_complete_path` via Oversized Input
Mantenedores costumam responder em até 1 dia
@Acen28 já está trabalhando nisso.
Desde 26/9/2026.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
RT-Thread Version
v5.3.0/git-hash: cda0a63
Affected area
FinSH
Hardware/BSP vendor
STM32
Architecture
ARM / AArch64
Board and hardware details
bsp/stm32/stm32f407-atk-explorer
Develop Toolchain
GCC
Describe the bug
Description
A critical Heap Out-of-Bounds (OOB) Write vulnerability (CWE-122) exists within the RT-Thread FinSH component, specifically in the path auto-completion logic (msh_auto_complete_path or related directory parsing functions).
When a user interacts with the msh shell (e.g., via a serial terminal or a remote network console) and attempts to trigger path auto-completion (typically using the <Tab> key) on an excessively long or deeply nested directory string, the underlying string manipulation routine fails to enforce strict boundary checks.
The function allocates a fixed-size buffer on the heap (often bounded by macros like RT_PATH_MAX or a hardcoded 256 bytes, e.g., full_path). During the concatenation of the current working directory and the user-supplied input, a while loop or strcpy/memcpy equivalent copies the oversized input string past the allocated bounds of the heap buffer.
This silent memory corruption overwrites adjacent heap metadata. The system does not crash immediately upon the OOB write. However, during the next memory allocation or deallocation cycle, the corrupted heap metadata is dereferenced, leading to an immediate HardFault or offering an attacker the potential for Heap-based Arbitrary Code Execution.
Prerequisites to Reproduce
- The FinSH/msh component is enabled and accessible to the user/attacker.
- The
RT_USING_DFS(Device Virtual File System) andRT_USING_DFS_DEVFSare enabled, allowing directory traversal and path completion.
Steps to Reproduce
- Boot the RT-Thread system and connect to the FinSH interactive shell (via UART or Telnet).
- Input an excessively long string intended as a directory path. For example, input
cd /followed by a payload of over 256 'A' characters:
msh > cd /AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... - Trigger the auto-complete function (usually by sending the
\t(Tab) character via the input stream). - The
msh_auto_complete_pathfunction attempts to parse and concatenate the path. The oversized string silently overflows thefull_pathheap buffer. - Execute any subsequent command that requires dynamic memory allocation (e.g.,
lsor running a network task). - The system throws a HardFault (or MemManage fault) due to corrupted heap metadata during
rt_mallocorrt_free.
Other additional context
No response
- Linguagem predominante
- C
- Estrelas
- 12.3k
- Forks
- 5.5k
- Merge médio
- 6d 32min
- PRs com merge (30d)
- 24
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de RT-Thread/rt-thread
-
[Bug] [libc] timer_gettime 拆秒前将总纳秒截断为 uint32_t,剩余时间查询错误Talvez já em andamento @Yunlk assumiu há 1 dia. Abertain progress
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
RT-Thread/rt-thread#11924 · 6 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
bug Component component: net
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
RT-Thread/rt-thread#11913 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[Bug] dfs_v2 tmpfs: ftruncate(fd, 0) frees the file buffer but reports success — use-after-free read/write and double free from a legal POSIX callTalvez já em andamento @remukisama assumiu há 6 dias. Abertain progress
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
RT-Thread/rt-thread#11902 · 4 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过Talvez já em andamento @moment-NEW assumiu há 23 dias. Abertain progress
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
RT-Thread/rt-thread#11818 · 4 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
BSP BSP: Loongson bug RT-Smart
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
RT-Thread/rt-thread#11717 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de RT-Thread/rt-thread
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
AOMediaCodec/SVT-AV1#3320 ·
-
Add `CPC_TAKE_TILL_CHARS`Abertadifficulty: easy
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
-
ML-KEM: OQS_KEM_encaps/decaps cannot do the FIPS 203 length (type) checks; please document itAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
open-quantum-safe/liboqs#2647 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Broken links in the docsAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia