cernec1999 / ssh-honeypot

5 stars 1 forks source link

Bug: Data race #20

Closed cernec1999 closed 3 years ago

cernec1999 commented 4 years ago
[DBG] SSH password attempt from 23.129.64.191:50955.
[DBG] Username: admin
[DBG] Password: 1234
[DBG] SSH connection authenticated for 23.129.64.191. Writing to database with ID 4.
[DBG] SSH password attempt from 198.199.69.181:41504.
[DBG] Username: root
[DBG] Password: mongoman
==================
WARNING: DATA RACE
Read at 0x0040003701b0 by goroutine 48:
  runtime.mapaccess1()
      /usr/local/go/src/runtime/map.go:394 +0x2ac
  main.main.func2()
      /home/ubuntu/ssh-honeypot/main.go:412 +0x39c
  golang.org/x/crypto/ssh.(*connection).serverAuthenticate()
      /home/ubuntu/go/pkg/mod/golang.org/x/crypto@v0.0.0-20201124201722-c8d3bf9c5392/ssh/server.go:479 +0xe54
  golang.org/x/crypto/ssh.(*connection).serverHandshake()
      /home/ubuntu/go/pkg/mod/golang.org/x/crypto@v0.0.0-20201124201722-c8d3bf9c5392/ssh/server.go:277 +0x83c
  golang.org/x/crypto/ssh.NewServerConn()
      /home/ubuntu/go/pkg/mod/golang.org/x/crypto@v0.0.0-20201124201722-c8d3bf9c5392/ssh/server.go:206 +0x210
  main.serveSSHConnection()
      /home/ubuntu/ssh-honeypot/main.go:174 +0x48

Previous write at 0x0040003701b0 by goroutine 30:
  runtime.mapassign()
      /usr/local/go/src/runtime/map.go:571 +0x57c
  main.serveSSHConnection()
      /home/ubuntu/ssh-honeypot/main.go:234 +0xa54

Goroutine 48 (running) created at:
  main.main()
      /home/ubuntu/ssh-honeypot/main.go:489 +0x4d0

Goroutine 30 (running) created at:
  main.main()
      /home/ubuntu/ssh-honeypot/main.go:489 +0x4d0
cernec1999 commented 4 years ago

Data race here: passwords := make(map[net.Addr]PasswordAttemptData)