Skip to content

Use fully qualified pathname when loading DLL to prevent security vulnerability #4377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 4, 2022

Conversation

jcwchen
Copy link
Member

@jcwchen jcwchen commented Jul 25, 2022

Description
To prevent security vulnerability, we should use fully qualified pathname when loading DLL.

Motivation and Context
Security vulnerability: The LoadLibrary*() family of functions are used to dynamically load a DLL into your
program. Most versions of the Windows operating system search the current directory first
when attempting to load files. If you do not specify a fully qualified pathname when loading
a Windows dynamic load library (DLL), the loader will attempt to locate the library in the
current directory. If there is a malicious library located in the current directory, it will be
loaded instead of the intended library.

…ulnerability

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
@jcwchen jcwchen requested a review from a team as a code owner July 25, 2022 22:07
jcwchen added 4 commits July 25, 2022 15:07
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Copy link
Contributor

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, not sure if the default LOAD_LIBRARY_SEARCH_DEFAULT_DIRS is still needed as a fully qualified path is used. But maybe its used for something else... your call.

@AlexandreEichenberger
Copy link
Contributor

Can an approved accept this PR as it is a potential vulnerability. Thanks

@jcwchen
Copy link
Member Author

jcwchen commented Jul 28, 2022

cc @onnx/sig-archinfra-approvers PTAL. Thanks!

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
@jcwchen
Copy link
Member Author

jcwchen commented Jul 28, 2022

LGTM, not sure if the default LOAD_LIBRARY_SEARCH_DEFAULT_DIRS is still needed as a fully qualified path is used. But maybe its used for something else... your call.

Thanks for catching this. LOAD_WITH_ALTERED_SEARCH_PATH seems more accurate for absolute path and so I will use it instead.

@jcwchen jcwchen enabled auto-merge (squash) August 4, 2022 14:04
@jcwchen jcwchen merged commit d10e15f into onnx:main Aug 4, 2022
@jcwchen jcwchen deleted the jcw/fix-onnxifi-vlun branch August 4, 2022 14:42
broune pushed a commit to broune/onnx that referenced this pull request May 6, 2023
…nerability (onnx#4377)

* Use a fully qualified pathname when loading DLL to prevent security vulnerability

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>

* use path instead of define

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>

* nit: style

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>

* LOAD_WITH_ALTERED_SEARCH_PATH

Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants