Skip to content

Commit e87790b

Browse files
committed
Add ElectronShellOpenExternalSink class
Add ElectronShellOpenExternalSink class to detect untrusted input interpreted by `openExternal` function call in `electron` module. Based on the #14 Electron Security checklist: https://www.electronjs.org/docs/tutorial/security#14-do-not-use-openexternal-with-untrusted-content
1 parent 7993a83 commit e87790b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/CodeInjectionCustomizations.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,15 @@ module CodeInjection {
138138
API::moduleImport("module").getInstance().getMember("_compile").getACall().getArgument(0)
139139
}
140140
}
141+
142+
/**
143+
* Improper use of openExternal can be leveraged to compromise the user's host.
144+
* When openExternal is used with untrusted content, it can be leveraged to execute arbitrary commands.
145+
*/
146+
class ElectronShellOpenExternalSink extends Sink {
147+
ElectronShellOpenExternalSink() {
148+
this =
149+
DataFlow::moduleMember("electron", "shell").getAMemberCall("openExternal").getArgument(0)
150+
}
151+
}
141152
}

0 commit comments

Comments
 (0)