fstd/pstd

crash: cannot determine peer address

Closed this issue · 2 comments

pstd_server.pl: 2019-12-06 22:45:57 +0000: 66.XX.XXX.XXX: Bad first data chunk 'GET /favicon.ico HTTP/1.1$$Host: 149.202.127.134:8080$$Accept: image/webp,image/apng,image/*,*/*;q=0.8$$Accept-Encoding: gzip, deflate$$Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7$$Forwarded: for=74.XX.XXX.XXX$$Referer: http://149.202.127.134:8080/44$$Save-Data: on$$Scheme: http$$Via: 1.1 Chrome-Compression-Proxy$$X-Forwarded-For: 74.XX.XXX.XXX$$Connection: keep-alive$$User-Agent: Mozilla/5.0 (Linux; Android 10; MI 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36$$$$'
pstd_server.pl: 2019-12-06 22:46:02 +0000: 66.XX.XXX.XXX: Bad first data chunk 'GET /favicon.ico HTTP/1.1$$Host: 149.202.127.134:8080$$Accept: image/webp,image/apng,image/*,*/*;q=0.8$$Accept-Encoding: gzip, deflate$$Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7$$Cache-Control: no-cache$$Forwarded: for=74.119.145.52$$Pragma: no-cache$$Referer: http://149.202.127.134:8080/44$$Save-Data: on$$Scheme: http$$Via: 1.1 Chrome-Compression-Proxy$$X-Forwarded-For: 74.119.145.52$$Connection: keep-alive$$User-Agent: Mozilla/5.0 (Linux; Android 10; MI 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36$$$$'
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 733 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    and the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.

Use of uninitialized value in concatenation (.) or string at ./pstd_server.pl
        line 733 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 734 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 744 (#1)
Use of uninitialized value in concatenation (.) or string at ./pstd_server.pl
        line 744 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 746 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 445 (#1)
Use of uninitialized value in concatenation (.) or string at ./pstd_server.pl
        line 445 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 447 (#1)
Use of uninitialized value $who in concatenation (.) or string at
        ./pstd_server.pl line 454 (#1)
pstd_server.pl: 2019-12-07 00:13:49 +0000: : Empty read
Uncaught exception from user code:
        send: Cannot determine peer address at ./pstd_server.pl line 553.
        IO::Socket::send(IO::Socket::INET=GLOB(0x5589ea216120), "HTTP/1.1 200 OK\x{d}\x{a}Content-Type: text/plain; charset=UTF-8\x{d}\x{a}Con"...) called at ./pstd_server.pl line 553
        main::respond(IO::Socket::INET=GLOB(0x5589ea216120), "text/plain", "ERROR: You what?\x{a}") called at ./pstd_server.pl line 455
        main::handle_clt(IO::Socket::INET=GLOB(0x5589ea216120), undef) called at ./pstd_server.pl line 748

I do not know what happend exactly the traffic looked like somebody was scanning my server for vulnerabilitys so it might be intentionally nasty but thats just an assumption. So I can not reproduce it sadly.
Was using the devel branch.

fstd commented

Seems to me like a bug in perls socket thingy; It doesn't know the peer's address after accepting a connection. I've committed a workaround (though yours is probably okay too)

Seems to be fixed. It did not crash because of this in 4 days. But lets wait for #3 so the server can run longer than 1 day without crash.