🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3654

Bug#1153131: shellinabox: directory traversal regression in --static-file handler (externalfile.c)

#3654
From: Andrew Bower
Date: Sat, 07 Nov 2026 11:40
45 lines
4133 bytes
Control: retitle -1 shellinabox: --static-file directory traversal guard ineffective

On Fri, Nov 06, 2026 at 03:37:38AM +0200, Alexandru-Ionut Jipa wrote:
> Done, both filed upstream:
> 
>   issue: https://github.com/shellinabox/shellinabox/issues/541
>   PR:    https://github.com/shellinabox/shellinabox/pull/540
> 
> The PR carries the strchr()-based variant (no glibc dependency), tested
> on an unmodified 4f0ecc3 build with the same request matrix as before;
> both reference #1153131 and your patch.

Excellent, thanks for that!

What makes you think this is a "regression", per the bug title? This
behaviour seems to have been present since this logic was first released
in this upstream commit:

commit aab20f5ed00104c8bc9d12d362085634ff64dead
Author: zodiac <zodiac@0da03de8-d603-11dd-86c2-0f8696b7b6f9>
Date:   Mon Dec 29 23:57:07 2008 +0000

    First public release of the version 2.0 rewrite. This is the
    first release of ShellInABox that supports an AJAX interface
    instead of the original Java applet.
    
    
    git-svn-id: https://shellinabox.googlecode.com/svn/trunk@2 0da03de8-d603-11dd-86c2-0f8696b7b6f9

I have suggested an alternative title but feel free to refine further it
you think it is inadequate.

I have come up with a simple reproducer that works from a bash prompt
in Linux using the packaged binary:

  mkdir /tmp/x
  unshare -rmn shellinaboxd -t -u 0 -g 0 --static-file /static:/tmp &
  nsenter -t $! -U -n --preserve-credentials
  ip link set up lo
  curl --path-as-is http://localhost:4200/static/x/../../etc/os-release
  exit
  kill %1

This will print the given file when the bug is present and return a 404
response when fixed.
Technical Details
Message-ID: <NWMW5-anLT-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <NWfx7-a4Vm-3@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWgWd-a5JE-3@gated-at.bofh.it> <NWgWd-a5JE-1@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWMW5-anLT-7@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWMW5-anLT-7@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Andrew Bower <andrew@bower.uk>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153131: shellinabox: directory traversal regression in --static-file handler (externalfile.c)
Date: Sat, 07 Nov 2026 12:40:01 +0100
Message-ID: <NWMW5-anLT-5@gated-at.bofh.it>
References: <NWfx7-a4Vm-3@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWgWd-a5JE-3@gated-at.bofh.it> <NWgWd-a5JE-1@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWMW5-anLT-7@gated-at.bofh.it> <NWfx7-a4Vm-5@gated-at.bofh.it> <NWMW5-anLT-7@gated-at.bofh.it>
X-Original-To: Alexandru-Ionut Jipa <jipaionut@gmail.com>, 1153131@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sat Nov  7 11:35:07 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Andrew Bower <andrew@bower.uk>, 1153131@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+salvage@tracker.debian.org
X-Debian-Pr-Message: followup 1153131
X-Debian-Pr-Package: shellinabox
X-Debian-Pr-Keywords: security upstream
X-Debian-Pr-Source: shellinabox
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/2.4.1 (2026-07-04)
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001248
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 45
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 7 Nov 2026 11:32:39 +0000
X-Original-Message-ID: <au8MV5VhIuYG280v@shenstone.ab8.net>
X-Original-References: <au0XY9jeUaZkUrGE@arden.ab8.net> <CAPrcYpig+gMVAKWX6FxRQkBQWt=VKZcyuwo9ZnRb5iejWAXT8Q@mail.gmail.com> <CAPrcYpjtZh-OtavVNkGYj6bWOFnSa8-k5GESJfKWL7z5N4ninw@mail.gmail.com> <au0sM0BJPmgiHIgu@arden.ab8.net> <CAPrcYpig+gMVAKWX6FxRQkBQWt=VKZcyuwo9ZnRb5iejWAXT8Q@mail.gmail.com> <CAPrcYpjQKYMiMgj-WpXz8k0ZLvJjUtAMTqOvwUhjdngK-x5kSQ@mail.gmail.com> <CAPrcYpig+gMVAKWX6FxRQkBQWt=VKZcyuwo9ZnRb5iejWAXT8Q@mail.gmail.com> <CAPrcYpjQKYMiMgj-WpXz8k0ZLvJjUtAMTqOvwUhjdngK-x5kSQ@mail.gmail.com>