#1139271 dcmd: Arbitrary code execution in `dcmd echo`

Package:
devscripts
Source:
devscripts
Description:
scripts to make the life of a Debian Package maintainer easier
Submitter:
kpcyrd
Date:
2026-11-07 17:09:02 UTC
Severity:
normal
Tags:
#1139271#5
Date:
2026-06-07 23:29:27 UTC
From:
To:
hello!

When I read through #1138907 the error message caught my attention and I crafted
a .changes file that executes arbitrary code when processed:
  ffffffffffffffffffffffffffffffff 1337 abc optional "$(id)"
--- >8 ---

$ /usr/bin/dcmd echo hax.changes
uid=1000(user) gid=1000(user) groups=1000(user),27(sudo),112(sbuild) hax.changes

This creates an undocumented execution path that may cross security boundaries
on Debian build server infrastructure.

This bug is related to #1138923.

Sincerely,
kpcyrd

#1139271#12
Date:
2026-07-14 09:58:38 UTC
From:
To:
Hi,

I may have missed it, but I did not find an easy way to avoid expansions
in current shell script implementation of dcmd.

I started playing with a perl implementation and seems I got something
that is apparently working. It is by far not the best perl you can find
(I wrote it ;-)), but seems to work.

In its current shape it adds some control on allowed extensions and avoids
expansions. (Checked listing "$(id)".deb, all other commands skip it as it
does not exists). It has an additional --debug option I used when writing
things.

Feel free to use it if you find it useful in some way (let me know if you
think is better to use GPL2+), as a proof of concept or whatever else.

Hope this helps,

#1139271#15
Date:
2026-11-07 12:51:46 UTC
From:
To:
Hello,

Bug #1139271 in devscripts reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/devscripts/-/commit/cd05e8b42ba1305bc05a9e3af2f364de4d6fa0a5
------------------------------------------------------------------------
dcmd: Reject shell metacharacters in filenames. (Closes: #1139271)

Add a dcmd test script.

While at it, fix the changes-in-changes code path.
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1139271

#1139271#22
Date:
2026-11-07 17:07:07 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
devscripts, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1139271@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Holger Levsen <holger@debian.org> (supplier of updated devscripts package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sat, 07 Nov 2026 17:55:42 +0100
Source: devscripts
Architecture: source
Version: 2.26.15
Distribution: unstable
Urgency: medium
Maintainer: Devscripts Maintainers <devscripts@packages.debian.org>
Changed-By: Holger Levsen <holger@debian.org>
Closes: 1139271
Changes:
 devscripts (2.26.15) unstable; urgency=medium
 .
   [ Christoph Berg ]
   * dcmd: Reject shell metacharacters in filenames. Closes: #1139271.
   * Add a dcmd test script.
   * Avoid infinite recursion when running test_dcmd --installed
Checksums-Sha1:
 a8444bf284f3e7aad731edec204e7d4ab676c227 3585 devscripts_2.26.15.dsc
 1f2adc117b6b8a0f09cc58f82b2e58ee88288557 1128540 devscripts_2.26.15.tar.xz
 3383439d205acf7122ea7e40c52e26c84f285448 21036 devscripts_2.26.15_source.buildinfo
Checksums-Sha256:
 e98873e0934fb41306657a27fc09825d856ef3c04a1f8523d9fffdfcee322550 3585 devscripts_2.26.15.dsc
 8eb4b5074d998fbdfb4c2b8912d073e8308d1b9628b12b0dbb59af0ec189159c 1128540 devscripts_2.26.15.tar.xz
 ad92167bcd38c774ab10157a6bf1fc66065b004647c203a8993550a7b8cf466b 21036 devscripts_2.26.15_source.buildinfo
Files:
 8f150c52fb3b07935877c9be150b8d65 3585 devel optional devscripts_2.26.15.dsc
 81452040bb368fab2644c6bcee8e0e81 1128540 devel optional devscripts_2.26.15.tar.xz
 f718c4408d950d7762496a6b921c9fa7 21036 devel optional devscripts_2.26.15_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEuL9UE3sJ01zwJv6dCRq4VgaaqhwFAmrvWGwACgkQCRq4Vgaa
qhzfXw/7Bvcgx5IOVny9ARARvEB+kCHAt/UO/5Vpq0qiVGtTnq0sIoWXIR9/gt1v
BeHAHKG4KcuCH/a7D2H7WtGZUFPzTlrsJSMjiIJr9n7qltMgBPoBoNv3xOlUmuh2
4kI2yXMTTXSeVDwI2k1kHYU+Ip4B8CkvUBoJApV1qMK1psAMroWRgL4wQ7OQtz+j
Puzj2fkWlbcAwivHHU2jCFOgidSShZsp7YmVmHmSGBU3fFAhhhJYTR2aa+RaHGnR
rgKtBQ+ElruWnuoqgM+gkpNpf8B3I9y0coqIPb5LkFN0wkVt6LU/47oEez7uh1+e
pOqe175Rh6vIaHteWB5FZTAVcSwtuS/dRdzj7WhdN6VsncZrjPxTMfPjwxDh/38U
O8hj/KvE8Q30bIv0Nnbs6PUd/Hgom1hE2KRD6voI4hQFMJW6zdpSdvvpvCqCR6n1
w+m/j7+WykmYDsQRzRjaBgLLAjT6cUBo4HHqEQ6xi0oWya+/Oh5JVc9htQVoN7oH
mO/UxUr/B2uFJPPcxG8uBUn37CyDwHZVUgyd7N8C/IWHKZxwEoTQvBU+tjYNNdVO
OEdQj1Qkpx4Qa+grcBSk+DhmYrsik1lTHiWCk4Y9FduoVw6K4vn6AtyKSw732MJE
Paba0AQWf8U98fkH7Tl/gahWswK0OijAxZpriP//WJLZHd3nc/o=
=2uzH
-----END PGP SIGNATURE-----