thomaspatzke/Log4Pot

Exception

t3chn0m4g3 opened this issue · 2 comments

Just noticed the following exception:

----------------------------------------
Exception occurred during processing of request from ('x.x.x.x', 55160)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 747, in __init__
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 395, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/usr/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
x.x.x.x - - [16/Dec/2021 13:44:23] "GET / HTTP/1.1" 200 -
x.x.x.x - - [16/Dec/2021 13:44:23] "GET / HTTP/1.1" 200 -

The according JSON log:

{"type": "request", "timestamp": "2021-12-16T13:44:23.029029", "correlation_id": "39f57c86-3b8a-46da-8ac1-568030215755", "server_port": 80, "client": "x.x.x.x", "port": 41482, "request": "GET / HTTP/1.1", "headers": {"Host": "y.y.y.y:80"}}
{"type": "request", "timestamp": "2021-12-16T13:44:23.258082", "correlation_id": "c01af0fb-dcdc-41f3-af09-8680c6c99d81", "server_port": 80, "client": "x.x.x.x", "port": 37514, "request": "GET / HTTP/1.1", "headers": {"Host": "y.y.y.y", "User-Agent": "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)", "Accept": "*/*", "Accept-Encoding": "gzip"}}

This happens completely while handling by http.server, outside of the honeypot code. This is caused by clients that terminate the connection before any HTTP processing can be done and shouldn't have an effect on the application code itself.

Thanks for the explanation.