Hello.
I would like to raise what I believe to be a security issue regarding a combination of two intentional features of SciTE.
SciTE can trivially be made to execute arbitrary commands when opening files, by setting option "command.discover.properties" (feature 1) in a local SciTE.properties file (feature 2).
This is unsafe in scenarios where a folder contains content that the user did not themselves create, such as:
To clarify the co-worker example, if the co-worker has used SciTE to open files from GitHub which triggered malicious code, the malicious code could then automatically apply the same attack to other repos on the same machine, or even steal their SSH keys, allowing the attacker to impersonate them.
I have confirmed this behaviour in SciTE 5.3.0 and 5.3.6.
For comparison, VScode has patched similar issues:
I believe git itself has also fixed similar issues (immediate code execution when cloning repos).
Proof of concept
Please see the attached (harmless) proof-of-concept zip file. (Although please note that I accept no liability)
The archive includes a SciTE.properties file that defines a value for "command.discover.properties".
In this instance, the value supplied is a windows command-line to create a file indicating that the code has been run.
If the zip is extracted into a folder and a user opens "arbitrary.txt" in SciTE, the command executes, creating file "bad.txt"
To make the attack more subtle, file SciTE.properties is given the hidden attribute, so it will not be visible in many file browsers.
(In a practical attack, the file could also be included in a folder with many other files, making it harder to spot)
Fix options
I suspect there are many ways this could be addressed, including:
Limits of this report
I have not exhaustively searched for similar code execution hooks, so there may be other similar features that might also need to be addressed before SciTE could be considered safe for general usage.
I have also not fully understood if there are implications for projects using Scintilla, or if this issue is purely restricted to SciTE.
Thanks
Thank you very much for your time, and continued efforts in making SciTE such a useful utility.
This is likely reasonable. Require
discover.properties=1in user properties or above (global properties) before usingcommand.discover.properties.Thank you for the quick response.
Confirmed, I can see how this would fix the issue.
I do have some follow-up questions:
JobQueuesubsystem with potential calls toCreateProcess,ShellExecuteEx, and help display withWinHelpWandHHCTRL.OCX. For GTK, theg_spawn_asyncandg_spawn_async_with_pipescalls are used. There is also the Lua scripting feature with Lua allowingos.execute,io.popenand possibly other calls. SciTE may be controlled by a director application and may ask that application to perform commands through IPC.I would suggest that this issue should remain private for now; making this issue public before a fixed build is released puts users at risk.
(According to the main download page, the latest version still appears to be 5.3.6, which I believe is vulnerable)
The degree of risk appears low to me and its better to be completely open with open-source projects.
Committed as [0ee29b].
Related
Commit: [0ee29b]