projects
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b09c179
)
Refuse to open a msglog file with .. in the path.
author
Jeremy Harris
<jgh146exb@wizmail.org>
Tue, 10 Sep 2019 11:29:12 +0000
(12:29 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Tue, 10 Sep 2019 11:33:28 +0000
(12:33 +0100)
Recent exploits have use this as a step for overwriting system files,
and msglog file should always be under the spooldir, so add this as
a defence-in-depth tactic
src/src/deliver.c
patch
|
blob
|
blame
|
history
diff --git
a/src/src/deliver.c
b/src/src/deliver.c
index 59fbeeaf9a18bc69694c1996a3e0970d114cac58..72751c2dc5d415404356df594df10f61fbddc1e6 100644
(file)
--- a/
src/src/deliver.c
+++ b/
src/src/deliver.c
@@
-328,6
+328,10
@@
Returns: a file descriptor, or -1 (with errno set)
static int
open_msglog_file(uschar *filename, int mode, uschar **error)
{
+if (Ustrstr(filename, US"/../"))
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "Attempt to open msglog file path with upward-traversal: '%s'\n", filename);
+
for (int i = 2; i > 0; i--)
{
int fd = Uopen(filename,