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

gnovm: *Debugger.Serve leaks the listener and never retains a reference to later close it #3028

Open
odeke-em opened this issue Oct 27, 2024 · 1 comment
Assignees
Labels
security Security-sensitive issue

Comments

@odeke-em
Copy link

While auditing and studying some code I noticed this code

func (d *Debugger) Serve(addr string) error {
l, err := net.Listen("tcp", addr)
if err != nil {
return err
}
print("Waiting for debugger client to connect at ", addr)
conn, err := l.Accept()
if err != nil {
return err
}
println(" connected!")
d.in, d.out = conn, conn
return nil
}

and notice that we create a listener bound to an address and immediately accept a single connection then discard the listener.

Please figure out how to singly create the listener once and then retain it and listen to connections on it each time. If this library is to be put to production and debuggers left on, with the very large surface that it has, it is imperative to avoid such problems that could then cause security issues, especially without automated static analysis and security tools.

Kindly cc-ing @jaekwon

@kristovatlas kristovatlas self-assigned this Oct 29, 2024
@kristovatlas kristovatlas added the security Security-sensitive issue label Oct 29, 2024
@kristovatlas
Copy link
Contributor

Thanks for the report, @odeke-em. We're looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Security-sensitive issue
Projects
Status: Triage
Development

No branches or pull requests

2 participants