windows: add DLL-hijacking warning;

famously, windows prefers cwd when resolving a binary to execute,
rather than a predefined PATH like linux / unix / every other OS

even worse, it also does this for DLLs, and mitigating *that*
is infeasible because it depends on variables we dont control

print a warning in case someone is unaware of this
This commit is contained in:
ed 2026-07-27 17:15:00 +00:00
parent c70dc7ac56
commit bb40804f2d

View file

@ -3059,6 +3059,8 @@ class AuthSrv(object):
zv, _ = vfs.get("", "*", False, True, err=999) zv, _ = vfs.get("", "*", False, True, err=999)
if self.warn_anonwrite and verbosity > 4 and os.getcwd() == zv.realpath: if self.warn_anonwrite and verbosity > 4 and os.getcwd() == zv.realpath:
t = "anyone can write to the current directory: {}\n" t = "anyone can write to the current directory: {}\n"
if ANYWIN:
t += "/!\\ NOTE: because you are using Windows, this is extra dangerous (DLL-hijacking)\n"
self.log(t.format(zv.realpath), c=1) self.log(t.format(zv.realpath), c=1)
self.warn_anonwrite = False self.warn_anonwrite = False