Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Unsafe DLL Loading #18

Closed
zx2c4 opened this issue Oct 8, 2019 · 5 comments · Fixed by #19
Closed

Unsafe DLL Loading #18

zx2c4 opened this issue Oct 8, 2019 · 5 comments · Fixed by #19
Assignees
Labels
bug Something isn't working good first issue Good for newcomers security There's a security impact

Comments

@zx2c4
Copy link

zx2c4 commented Oct 8, 2019

You're using syscall, but you should be using x/sys/windows's lazy DLL struct instead:

kernel32DLL = syscall.NewLazyDLL("kernel32.dll")
advapi32DLL = syscall.NewLazyDLL("advapi32.dll")
userenvDLL = syscall.NewLazyDLL("userenv.dll")
psapiDLL = syscall.NewLazyDLL("psapi.dll")
iphlpapiDLL = syscall.NewLazyDLL("iphlpapi.dll")

iphlpapi.dll and userenv.dll are not part of \KnownDlls.

Your blog post indicates you know about the right way to do it but for some reason didn't.

@justenwalker justenwalker added bug Something isn't working good first issue Good for newcomers security There's a security impact labels Oct 8, 2019
@justenwalker
Copy link
Contributor

justenwalker commented Oct 8, 2019

Thanks for the find @zx2c4. Do you have time to make the PR to fix it?

@zx2c4
Copy link
Author

zx2c4 commented Oct 8, 2019

I have no idea what this project does or is used for, but I thought you had an interesting Windows library so I was poking around with it. You're probably a better person to fix this than me.

@justenwalker
Copy link
Contributor

Sure, just wanted to give you first dibs on fixing it if you were interested. Thank you anyway for reporting, I'll take care of it.

@justenwalker justenwalker self-assigned this Oct 8, 2019
@justenwalker
Copy link
Contributor

Neat, I'll take a look at this too. Thanks for the tip!

justenwalker added a commit that referenced this issue Oct 8, 2019
Use golang.org/x/sys/windows NewLazySystemDLL

Fixes: #18
@justenwalker justenwalker added the in progress Work is in-progress on this issue label Oct 8, 2019
justenwalker added a commit that referenced this issue Oct 8, 2019
Use golang.org/x/sys/windows NewLazySystemDLL

Fixes: #18
@justenwalker justenwalker removed the in progress Work is in-progress on this issue label Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers security There's a security impact
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants