Enable DLL preloading protection by default on >= 6.10

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Enable DLL preloading protection by default on >= 6.10

Post by Quin »

When the DLL protection checkbox was added, its default state was set to unchecked for Windows XP support. I can't find the topic now, but I thought Fred said this would be changed after XP support was dropped. But, at least in 6.10, it's still unchecked by default ;)
Is it possible to have it checked by default on any version that doesn't support XP (I for one always check it for every project).
Thanks.
Little John
Addict
Addict
Posts: 4801
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Enable DLL preloading protection by default on >= 6.10

Post by Little John »

You can enable this by default in the IDE preferences under “Compiler” > “Standards”.
As far as I can see, this setting is independent of the setting for modern theme support (for Windows XP and newer).
Fred
Administrator
Administrator
Posts: 18344
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Enable DLL preloading protection by default on >= 6.10

Post by Fred »

No I don't think we won't enable it by default as it is not done in other mainstream languages (C/C++) so it should have a good reason for that. I don't have enough experience on this topic to force this behaviour to every PB programs.
BarryG
Addict
Addict
Posts: 4214
Joined: Thu Apr 18, 2019 8:17 am

Re: Enable DLL preloading protection by default on >= 6.10

Post by BarryG »

Is this feature even needed if I hard-code the path to system DLLs in my app? That's what I'm currently doing, in addition to enabling it. But maybe enabling it isn't necessary when hard-coding?
User avatar
jacdelad
Addict
Addict
Posts: 2027
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Enable DLL preloading protection by default on >= 6.10

Post by jacdelad »

If it's hard-coded, it doesn't matter. It's more about system DLLs potentially being replaced/rerouted by malicious pendants.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
BarryG
Addict
Addict
Posts: 4214
Joined: Thu Apr 18, 2019 8:17 am

Re: Enable DLL preloading protection by default on >= 6.10

Post by BarryG »

Good to know! Thanks.
Fred
Administrator
Administrator
Posts: 18344
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Enable DLL preloading protection by default on >= 6.10

Post by Fred »

The patch is done before any code is executed, using full path at runtime isn't enough
BarryG
Addict
Addict
Posts: 4214
Joined: Thu Apr 18, 2019 8:17 am

Re: Enable DLL preloading protection by default on >= 6.10

Post by BarryG »

Interesting. So I could remove my hard-coded paths, then, since they're not effective? Just use the DLL filename (like "kernel32.dll")?
User avatar
jacdelad
Addict
Addict
Posts: 2027
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Enable DLL preloading protection by default on >= 6.10

Post by jacdelad »

Ouch!
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Fred
Administrator
Administrator
Posts: 18344
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Enable DLL preloading protection by default on >= 6.10

Post by Fred »

BarryG wrote: Sat Jul 13, 2024 9:39 am Interesting. So I could remove my hard-coded paths, then, since they're not effective? Just use the DLL filename (like "kernel32.dll")?
I didn't said it's not effective, but not enough as all the DLL loaded before the code is run are not cover by this. Load library() now takes care of this automatically so it's not needed to use a full path (but you still can it won't hurt)
Thorium
Addict
Addict
Posts: 1308
Joined: Sat Aug 15, 2009 6:59 pm

Re: Enable DLL preloading protection by default on >= 6.10

Post by Thorium »

I don't think it's good to use it on every app. There are downsides to it as there are legit reasons to preload another DLL.
For example to fix compatibility issues on older apps. Your apps will grow old eventually.

It makes sense if your app is expected to run under admin. In this case it prevents elevation of privileges. But if your app runs under user there is nothing to gain for an attacker. As it already has user access to your system at that point, otherwise it could not perform the attack.
Post Reply