Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2074?usp=email
to review the following change.
Change subject: port-share: do not follow symlinks when writing journal file
......................................................................
port-share: do not follow symlinks when writing journal file
journal_add() creates <journal dir>/<local ip:port> with
O_CREAT | O_TRUNC and writes the remote client's address into it.
The name is predictable (the proxy connection's ephemeral local port)
and the write is triggered by any TCP client sending non-OpenVPN data
to the shared port. Anyone who can create entries in the journal
directory can therefore plant symlinks and have the port-share process,
which runs as root unless --user is used, truncate and overwrite an
arbitrary file with the client address.
The journal file is always a regular file that we create ourselves, so
refuse to follow a symlink when opening it.
Github: closes OpenVPN/openvpn#1124
Change-Id: I70ebdadd660e41b40ed53f4238be6885f0a7bb8b
Signed-off-by: Naveed Khan <[email protected]>
---
M src/openvpn/ps.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/74/2074/1
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index 03c6f48..f730036 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -341,7 +341,8 @@
check_malloc_return(jfn);
snprintf(jfn, fnlen, "%s/%s", journal_dir, t);
dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s",
jfn, f);
- int fd = platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR |
S_IWUSR | S_IRGRP);
+ int fd = platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY | O_NOFOLLOW,
+ S_IRUSR | S_IWUSR | S_IRGRP);
if (fd != -1)
{
ssize_t write_len = strlen(f);
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2074?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I70ebdadd660e41b40ed53f4238be6885f0a7bb8b
Gerrit-Change-Number: 2074
Gerrit-PatchSet: 1
Gerrit-Owner: Gert Doering <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel