Your message dated Fri, 20 Nov 2026 18:07:43 +0000
with message-id <[email protected]>
and subject line Bug#1152900: fixed in cron 3.0pl1-214
has caused the Debian Bug report #1152900,
regarding cron: bound /etc/cron.d filename construction to avoid stack overwrite
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1152900: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1152900
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: cron
Version: 3.0pl1-212
Severity: normal
Tags: patch

While scanning /etc/cron.d, cron prefixes each accepted filename with
"*system*" in a fixed-size fname buffer using strcpy()/strcat(). A
valid maximum-length directory entry can exceed the remaining buffer
capacity and overwrite stack memory. On the usual filesystem this
requires creating a long name in the root-controlled /etc/cron.d
directory, so this is a hardening and reliability issue; no
unprivileged control or privilege escalation was demonstrated.

The attached Debian -212 patch uses checked snprintf() construction
for both the prefixed internal name and the path, and skips an entry
that does not fit. Its regression test covers exact accepted and
first-rejected filename/path boundaries.

The patched Debian source built in a disposable trixie container; the
focused regression and all 13 existing Debian integration tests
passed. Ubuntu versions 3.0pl1-200ubuntu1 and -209ubuntu1 have the
same issue. Debian and Ubuntu Security Teams recommended public bug
reports.

Regards,
Brett Sutton
Description: Bound construction of system crontab names and paths
Origin: other, private Daybreak audit
Forwarded: no

--- a/cron.h
+++ b/cron.h
@@ -347,3 +347,5 @@
 #endif /*MAIN_PROGRAM*/
 
 int cron_gethostname(char *, size_t);
+
+int cron_system_name(char *, size_t, char *, size_t, const char *);
--- a/database.c
+++ b/database.c
@@ -190,9 +190,11 @@
 		  continue;
 
 		/* Generate the "fname" */
-		(void) strcpy(fname,"*system*");
-		(void) strcat(fname, dp->d_name);
-		sprintf(tabname,"%s/%s", SYSCRONDIR, dp->d_name);
+		if (!cron_system_name(fname, sizeof fname, tabname,
+				sizeof tabname, dp->d_name)) {
+			log_it("CRON", getpid(), "NAME TOO LONG", dp->d_name);
+			continue;
+		}
 
 		/* statbuf is used as working storage by process_crontab() --
 		   current contents are irrelevant */
--- a/misc.c
+++ b/misc.c
@@ -802,4 +802,15 @@
 		(void) strcpy(hostname, "localhost");
 	hostname[size - 1] = '\0';
 	return TRUE;
-}
\ No newline at end of file
+}
+/* Reject names that cannot fit both the internal marker and the path. */
+int
+cron_system_name(char *name, size_t name_size, char *path, size_t path_size,
+		 const char *filename)
+{
+	int name_len = snprintf(name, name_size, "*system*%s", filename);
+	int path_len = snprintf(path, path_size, "%s/%s", SYSCRONDIR, filename);
+	return name_len >= 0 && path_len >= 0 &&
+		(size_t)name_len < name_size && (size_t)path_len < path_size;
+}
+
--- /dev/null
+++ b/tests/system_name_regression.c
@@ -0,0 +1,17 @@
+#define MAIN_PROGRAM
+#include "../misc.c"
+#include <assert.h>
+int main(void) {
+	char name[MAXNAMLEN + 1], path[PATH_MAX + 1], filename[MAXNAMLEN + 1];
+	size_t accepted = sizeof name - sizeof "*system*";
+	memset(filename, 'a', sizeof filename);
+	filename[accepted + 1] = '\0';
+	assert(!cron_system_name(name, sizeof name, path, sizeof path, filename));
+	filename[accepted] = '\0';
+	assert(cron_system_name(name, sizeof name, path, sizeof path, filename));
+	assert(strlen(name) == sizeof name - 1);
+	assert(strlen(path) == strlen(SYSCRONDIR) + 1 + accepted);
+	assert(!cron_system_name(name, sizeof name, path, strlen(SYSCRONDIR) + 1 + accepted, filename));
+	assert(cron_system_name(name, sizeof name, path, strlen(SYSCRONDIR) + 2 + accepted, filename));
+	return 0;
+}

--- End Message ---
--- Begin Message ---
Source: cron
Source-Version: 3.0pl1-214
Done: Georges Khaznadar <[email protected]>

We believe that the bug you reported is fixed in the latest version of
cron, 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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Georges Khaznadar <[email protected]> (supplier of updated cron 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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 06 Nov 2026 09:13:53 +0100
Source: cron
Architecture: source
Version: 3.0pl1-214
Distribution: unstable
Urgency: medium
Maintainer: Georges Khaznadar <[email protected]>
Changed-By: Georges Khaznadar <[email protected]>
Closes: 1152899 1152900
Changes:
 cron (3.0pl1-214) unstable; urgency=medium
 .
   * Replace host name by "localhost" when its length is excessive.
     Closes: #1152899
   * discard  too long file names to prevent buffer overflows when
     writing to /etc/cron.d; Closes: #1152900
Checksums-Sha1:
 6a521c835c3a45566ab7461fa6d8649fcb7d7911 2189 cron_3.0pl1-214.dsc
 aa81ae80a7ed08a1b981044d54a0b016f36820d8 143228 cron_3.0pl1-214.debian.tar.xz
 3b305792eb353442d95be8617cee09ff3e0aba5e 6535 cron_3.0pl1-214_source.buildinfo
Checksums-Sha256:
 30b3e5d4f218c41e27d41f65e38691180415b10b39ae899af60e6348ccf89dd5 2189 
cron_3.0pl1-214.dsc
 5eef515e6861cecce20ba49c928cac001ee1e7e499c7c4e1c21b97b88edc7fd5 143228 
cron_3.0pl1-214.debian.tar.xz
 c0653c599f71d90e5ec7984ce707d760b81123a6bca40b942e327256e9a42800 6535 
cron_3.0pl1-214_source.buildinfo
Files:
 b7a287d38d8c8a2242c5dbc186493061 2189 admin important cron_3.0pl1-214.dsc
 54a7087202b1775720d1f81e607aeff7 143228 admin important 
cron_3.0pl1-214.debian.tar.xz
 001d2e9979b43cb5c48a8769391607a8 6535 admin important 
cron_3.0pl1-214_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEM0CzZP9nFT+3zK6FHCgWkHE2rjkFAmsAiQsUHGdlb3JnZXNr
QGRlYmlhbi5vcmcACgkQHCgWkHE2rjne9RAAisXawXCMHDUCxUqtbwnKMCVB2V2P
f7FnO+xXfS00VVukVaCCB6tQM+n7Ki9m3D+UF9jIOlCeF/GQsb1hm6QvYRG6x1wF
WwOYCcRIXrANV4T9edFExXAf6Rd/PpXMVnPj0sPZkNJHvIbmiIpWb5YwRo8tgWHP
a4VA+bJv6pd8RGpMthfv5Hmuae5AX/Dgjb2IZHI1DHx7BhpooB6GUpIhmGufB5Wx
lXQ4ysMr8dqeKhq9g/YRkNUCq8cOAlo+wFJKu4aO4toeYWDoD1NSf9hlsZjSt7B0
jR/HNOcUUTQHg60bDHS/S+k26R++ff0spwm7qrnn9LkhKSGdDus8CWMNS214PLcP
I1+FdpzE6Te1muWTsG1R/izxqarGzDPIlz3PcXYOU2NHcJcVoILEmMLI0PcLQEDP
IN8S2US/Ar1rTmv+or2sfu/i9AEVKku4sUpEYeIxBg4RGxrwB/W7qcU6ouGhkwDD
ILRxX/e4QWF4BlVLn4h4ZQfsz+o2ewMSLr0rneKBSAlHi2CNDeVp5pyUd2rgF7W4
GiQ/2uddB60336ibGLsMFc27gm4MSLVi3duEA2joxgA7XlAa2ayJHhS4cGnCa4H0
U9nIQHYcgNiqhGnTFtG9yq9PtC3Z5dqXENZw2q/6zSI3kNJdA8vOzWRS389LjvWK
T1dSWRxVaf8WgU8=
=qhdU
-----END PGP SIGNATURE-----

Attachment: pgphJbAlIQFT0.pgp
Description: PGP signature


--- End Message ---

Reply via email to