forked from p15670423/monkey
Island: Do not allow Windows ransomware target paths beginning with "$"
As far as I can tell, environment variables in Windows look like %NAME%. Variables in powershell begin with $, but file explorer doesn't recognize paths beginning with $ as valid.
This commit is contained in:
parent
df6082b50a
commit
9d4ee88e09
|
@ -11,7 +11,7 @@ const linuxPathStartsWithTildeRegex = /^~/ // path starts with `~`
|
||||||
const windowsAbsolutePathRegex = /^([A-Za-z]:(\\|\/))/ // path starts like `C:\` OR `C:/`
|
const windowsAbsolutePathRegex = /^([A-Za-z]:(\\|\/))/ // path starts like `C:\` OR `C:/`
|
||||||
const windowsEnvVarNonNumeric = '[A-Za-z#\\$\'\\(\\)\\*\\+,-\\.\\?@\\[\\]_`\\{\\}~+ ]'
|
const windowsEnvVarNonNumeric = '[A-Za-z#\\$\'\\(\\)\\*\\+,-\\.\\?@\\[\\]_`\\{\\}~+ ]'
|
||||||
const windowsPathStartsWithEnvVariableRegex = new RegExp(
|
const windowsPathStartsWithEnvVariableRegex = new RegExp(
|
||||||
`^\\$|^%(${windowsEnvVarNonNumeric}+(${windowsEnvVarNonNumeric}|\\d)*)%`
|
`^%(${windowsEnvVarNonNumeric}+(${windowsEnvVarNonNumeric}|\\d)*)%`
|
||||||
);// path starts like `$` OR `%abc%`
|
);// path starts like `$` OR `%abc%`
|
||||||
|
|
||||||
const emptyRegex = /^$/
|
const emptyRegex = /^$/
|
||||||
|
|
Loading…
Reference in New Issue