lsc icon indicating copy to clipboard operation
lsc copied to clipboard

Insecure temp file creation

Open linnea-s opened this issue 6 years ago • 7 comments

The sample configuration and scripts write many files to /tmp, as can be seen with fgrep -r /etc lsc. In particular bin/lsc and and etc/logback.xml, which are probably used unchanged by many users following the instructions on the website. These temporary files have known, fixed names. This is insecure and can lead to information disclosure or overwriting of files by another user on the system. See e.g. https://cwe.mitre.org/data/definitions/377.html

I suggest defaulting to writing logs to LSC_HOME, and using a secure method for creating temporary files and directories.

linnea-s avatar Oct 02 '19 19:10 linnea-s

The log directory is already changed in packages (RPM/Debian).

It could indeed be changed in the source code.

coudot avatar Oct 03 '19 07:10 coudot

This requires changes in bin/lsc and logback.xml

coudot avatar Feb 10 '20 13:02 coudot

Packaging files must also be updated

coudot avatar Jul 15 '21 09:07 coudot

In debian lsc packages, I have not found in reference to tmp directory in /usr/bin/lsc, nor /etc/lsc/* Maybe this problem is only present in source files.

davidcoutadeur avatar Oct 06 '23 17:10 davidcoutadeur

Proposed solution: create a randon tmp dir (mktemp with lsc prefix) for LOG_DIR. But LOG_DIR will still be overridden in RPM and DEB.

coudot avatar Oct 12 '23 13:10 coudot

Not so easy.

LOG_DIR in bin/lsc is used only for logging start and end of lsc run.

The main problem is to fix logback.xml:

<property name="logdir" value="/tmp/lsc/log" />

I am working on this.

davidcoutadeur avatar Oct 19 '23 12:10 davidcoutadeur

Done in 77ff84bf

davidcoutadeur avatar Oct 19 '23 16:10 davidcoutadeur