G
Guest
I observed some interesting behaviour during some testing of
Assembly.LoadFrom. I noticed that Assembly.LoadFrom (and
Activator.CreateInstanceFrom) seems to extend the probing directory list.
i.e. the private probe paths seem to include both AppDomain.ApplicationBase
and the directory specified in the LoadFrom call.
I would have expected it would be more secure to override ApplicationBase.
For example, given the following files:
APP\APP.exe
APP\Manager.dll
RULES\MgrUtil.dll
RULES\rule.dll
Where Manager.dll has a reference to MgrUtil.dll.
If I create an AppDomain whose ApplicationBase is RULES that uses
Assembly.LoadFrom("..\Manager.dll") the load works. I would have expected it
to only work if MgrUtil.dll was in APP, despite RULES being a subdirectory of
APP. Adding RULES to the probing list would be easy; I just didn't expect
the default behaviour to not require it.
Security/permissions and expansion of relative paths have not been shown.
Is this by design?
Assembly.LoadFrom. I noticed that Assembly.LoadFrom (and
Activator.CreateInstanceFrom) seems to extend the probing directory list.
i.e. the private probe paths seem to include both AppDomain.ApplicationBase
and the directory specified in the LoadFrom call.
I would have expected it would be more secure to override ApplicationBase.
For example, given the following files:
APP\APP.exe
APP\Manager.dll
RULES\MgrUtil.dll
RULES\rule.dll
Where Manager.dll has a reference to MgrUtil.dll.
If I create an AppDomain whose ApplicationBase is RULES that uses
Assembly.LoadFrom("..\Manager.dll") the load works. I would have expected it
to only work if MgrUtil.dll was in APP, despite RULES being a subdirectory of
APP. Adding RULES to the probing list would be easy; I just didn't expect
the default behaviour to not require it.
Security/permissions and expansion of relative paths have not been shown.
Is this by design?