Skip to content

Commit 730347c

Browse files
committed
Fix RSS notifier.
1 parent a0c62c1 commit 730347c

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Changes in CUPS v2.4.17 (YYYY-MM-DD)
77

88
- CVE-2026-27447: The scheduler treated local user and group names as case-
99
insensitive.
10+
- CVE-2026-NNNNN: The RSS notifier could write outside the scheduler's RSS
11+
directory.
1012
- The scheduler followed symbolic links when cleaning out its temporary
1113
directory (Issue #1448)
1214
- Updated `cupsFileGetConf` and `cupsFilePutConf` to escape more characters.

notifier/rss.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
22
* RSS notifier for CUPS.
33
*
4-
* Copyright © 2020-2024 by OpenPrinting.
5-
* Copyright 2007-2015 by Apple Inc.
6-
* Copyright 2007 by Easy Software Products.
4+
* Copyright © 2020-2026 by OpenPrinting.
5+
* Copyright © 2007-2015 by Apple Inc.
6+
* Copyright © 2007 by Easy Software Products.
77
*
8-
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8+
* Licensed under Apache License v2.0. See the file "LICENSE" for more
9+
* information.
910
*/
1011

1112
/*
@@ -80,6 +81,7 @@ main(int argc, /* I - Number of command-line arguments */
8081
http_status_t status; /* HTTP GET/PUT status code */
8182
char filename[1024], /* Local filename */
8283
newname[1024]; /* filename.N */
84+
struct stat fileinfo; /* Local file information */
8385
cups_lang_t *language; /* Language information */
8486
ipp_attribute_t *printer_up_time, /* Timestamp on event */
8587
*notify_sequence_number,/* Sequence number */
@@ -111,9 +113,9 @@ main(int argc, /* I - Number of command-line arguments */
111113

112114
if (httpSeparateURI(HTTP_URI_CODING_ALL, argv[1], scheme, sizeof(scheme),
113115
username, sizeof(username), host, sizeof(host), &port,
114-
resource, sizeof(resource)) < HTTP_URI_OK)
116+
resource, sizeof(resource)) < HTTP_URI_OK || strstr(resource, "../") != NULL)
115117
{
116-
fprintf(stderr, "ERROR: Bad RSS URI \"%s\"!\n", argv[1]);
118+
fprintf(stderr, "ERROR: Bad RSS URI \"%s\".\n", argv[1]);
117119
return (1);
118120
}
119121

@@ -209,6 +211,12 @@ main(int argc, /* I - Number of command-line arguments */
209211
snprintf(filename, sizeof(filename), "%s/rss%s", cachedir, resource);
210212
snprintf(newname, sizeof(newname), "%s.N", filename);
211213

214+
if (!lstat(filename, &fileinfo) && !S_ISREG(fileinfo.st_mode))
215+
{
216+
fprintf(stderr, "ERROR: Local RSS path \"%s\" is not a file.\n", filename);
217+
return (1);
218+
}
219+
212220
httpAssembleURIf(HTTP_URI_CODING_ALL, baseurl, sizeof(baseurl), "http",
213221
NULL, server_name, atoi(server_port), "/rss%s", resource);
214222
}

scheduler/ipp.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* IPP routines for the CUPS scheduler.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting
4+
* Copyright © 2020-2026 by OpenPrinting
55
* Copyright © 2007-2021 by Apple Inc.
66
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
77
*
@@ -1997,6 +1997,12 @@ add_job_subscriptions(
19971997
"notify-status-code", IPP_ATTRIBUTES);
19981998
return;
19991999
}
2000+
else if (!strcmp(scheme, "rss") && strstr(resource, "../") != NULL)
2001+
{
2002+
send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Bad notify-recipient-uri URI \"%s\"."), recipient);
2003+
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM, "notify-status-code", IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES);
2004+
return;
2005+
}
20002006
}
20012007
else if (!strcmp(attr->name, "notify-pull-method") &&
20022008
attr->value_tag == IPP_TAG_KEYWORD)
@@ -6067,6 +6073,12 @@ create_subscriptions(
60676073
"notify-status-code", IPP_ATTRIBUTES);
60686074
return;
60696075
}
6076+
else if (!strcmp(scheme, "rss") && strstr(resource, "../") != NULL)
6077+
{
6078+
send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Bad notify-recipient-uri URI \"%s\"."), recipient);
6079+
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM, "notify-status-code", IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES);
6080+
return;
6081+
}
60706082
}
60716083
else if (!strcmp(attr->name, "notify-pull-method") &&
60726084
attr->value_tag == IPP_TAG_KEYWORD)

0 commit comments

Comments
 (0)