NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/60941: atto: shell command injection by malicious file name on tab complete



>Number:         60941
>Category:       bin
>Synopsis:       atto: shell command injection by malicious file name on tab complete
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 30 00:25:00 +0000 2026
>Originator:     Kilian Feess
>Release:        NetBSD-current (11.99.9), src/usr.bin/atto as of 2026-10-30
>Organization:
>Environment:
Linux CelsiusM770 7.0.0-42-generic #42-Ubuntu SMP PREEMPT_DYNAMIC Thu Oct 15 08:06:44 UTC 2026 x86_64 GNU/Linux

>Description:
Pressing tab at any file prompt abuses the shell to auto complete

complete.c:52
strcpy(sys_command, "echo ");
strcat(sys_command, buf);          /* your prompt text, unquoted, unescaped */
if (!iswild) strcat(sys_command, "*");
strcat(sys_command, " >");
strcat(sys_command, temp_file);
strcat(sys_command, " 2>&1");
(void) system(sys_command);

Basically the trick is to use $ echo <pattern>* > tempfile
for tab completion

If a malicious filename is placed that contains shell commands it can execute under the current implementation of tab complete.

This issue exists in upstream as well https://github.com/hughbarney/atto

I used the GLM 5.3 LLM to find this bug.
>How-To-Repeat:
attacker plants a file

touch 'x;id>pwned;#'

C-x C-f to find a file, type x, press Tab, press any non-tab char(*), press Tab (injected prompt executes now)

(*) this can be an arrow key alphanumeric, anything but Tab, to reset didtry to 0


>Fix:
use glob.h




Home | Main Index | Thread Index | Old Index