Skip to content
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

linux implementation can read arbitrary files #27

Closed
mlc opened this issue Aug 20, 2019 · 3 comments
Closed

linux implementation can read arbitrary files #27

mlc opened this issue Aug 20, 2019 · 3 comments

Comments

@mlc
Copy link

mlc commented Aug 20, 2019

execFile("cat", ["/sys/class/net/" + iface + "/address"], function (err, out) {

By prepending ../../.. to the "interface" name, this line of code can be asked read a file from anywhere on the filesystem as long as that file is named address.

It is also a little bit strange to run cat to read a file rather than just using the node fs module, but patching only that will not solve the security problem.

@scravy
Copy link
Owner

scravy commented Apr 21, 2020

There used to be a very old and ancient version of node which for whatever reason did not read the contents of textfiles in /sys properly, which is why cat was used.

The name of the interface could well be sanitized.

Do you mind opening a pull request?

@scravy scravy added this to the 0.5.0 milestone Apr 21, 2020
@scravy scravy closed this as completed in ca9e24d May 4, 2020
scravy added a commit that referenced this issue May 4, 2020
@scravy
Copy link
Owner

scravy commented May 4, 2020

Has been fixed and released in v0.4.3

@mlc
Copy link
Author

mlc commented May 4, 2020

thanks, @scravy!

@scravy scravy added the fixed label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants