[Bug] Heap Buffer Overflow in FinSH `msh_auto_complete_path` via Oversized Input
Maintainer antworten meist innerhalb von 1 Tag
@Acen28 arbeitet bereits daran.
Seit 26.9.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- C
- Sterne
- 12.3k
- Forks
- 5.5k
- Ø Merge
- 4 T. 12 Std.
- Gemergte PRs (30 T.)
- 32
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus RT-Thread/rt-thread
-
[Bug] [netdev] ping crashes the shell with a division by zero when the target is unreachable (received == 0)Evtl. vergeben @r3wretrhy hat das vor 1 Tag übernommen. Offenbug Component component: net
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
RT-Thread/rt-thread#11852 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过Evtl. vergeben @moment-NEW hat das vor 4 Tagen übernommen. Offenin progress
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
RT-Thread/rt-thread#11818 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
BSP BSP: Loongson bug RT-Smart
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
RT-Thread/rt-thread#11717 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Arch: RISC-V BSP BSP: HPMicro bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
RT-Thread/rt-thread#11687 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
RT-Thread/rt-thread#11472 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in RT-Thread/rt-thread
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
openwrt/firmware-utils#82 ·
-
area:http-gateway good first issue priority:low type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
crazy-goat/php-fpm-ng#870 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Discover carries headerEdges that nothing reads since #1914 moved E0507/E0517 to the compiler graphOffentech-debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
2个显示的问题Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
coolsnowwolf/lede#14209 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100
polhenarejos/pico-hsm#147 ·