Skip to content

[python-package] [dask] bind socket to local IP when searching for open ports #6916

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

odaysec
Copy link

@odaysec odaysec commented May 17, 2025

self.socket.bind(("", 0))

Fix the issue the socket should be bound to a specific interface instead of all interfaces. This can be achieved by replacing the empty string ("") with a specific IP address. If the IP address is not known in advance, it can be dynamically determined using socket.gethostbyname(socket.gethostname()), which retrieves the IP address of the current machine. This ensures that the socket is bound only to the local machine's primary interface.

The changes will be made in the _RemoteSocket.acquire method, specifically on line 71 where the bind call is made.


@jameslamb jameslamb changed the title [python-package] Fix Binding a socket to all network interfaces could lead CVE-2018-1281 [python-package] [dask] bind socket to local IP when searching for open ports May 20, 2025
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to contribute. I'll test this in a true distributed cluster before merging it (not something that happens automatically in our CI).

I've also changed the title... in the future, please follow the security policy at https://github.com/microsoft/LightGBM/security/policy. Especially "do not report security vulnerabilities through public GitHub issues" (as you did by including a vulnerability ID in the PR title here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants