ipsec plugin uses insecure temporary file
Status: Inactive
Brought to you by:
jameschapman
From plugins/ipsec.c:
#define IPSEC_SETKEY_FILE "/tmp/openl2tpd-tmp"
and later:
FILE *f = fopen(IPSEC_SETKEY_FILE, "w");
This is insecure code – any user on the local system, that can write to /tmp could create a symlink to any root-owned file and openl2tpd will overwrite the file when preparing input for 'setkey'.
The solution is to use a secure temporary file, e.g. created with mkstemp(), or write the file in a directory only root can write to (e.g. /var/run/openl2tp).
Thankyou fo this bug report.
Could you submit a patch?
Thanks for reporting this. We've implemented a fix as suggested for the next release.