Skip to content

Security fixes: malformed packet handling, thread safety, and per-connection isolation - #3

Open
M-Tesla wants to merge 1 commit into
NullPointer-Labs:mainfrom
M-Tesla:main
Open

Security fixes: malformed packet handling, thread safety, and per-connection isolation#3
M-Tesla wants to merge 1 commit into
NullPointer-Labs:mainfrom
M-Tesla:main

Conversation

@M-Tesla

@M-Tesla M-Tesla commented Jun 7, 2026

Copy link
Copy Markdown

This PR addresses the security issues described in #.

Fixes

  • Remote DoS via malformed packets: the server no longer crashes on BufferUnderflowException. Malformed requests now return Invalid request and the connection stays alive.
  • Shared network buffer: replaced the single shared ByteBuffer with per-connection buffers attached to each SelectionKey.
  • Thread-unsafe BufferPoolManager: synchronized all public methods to prevent torn writes and race conditions with the background checkpoint thread.
  • Connection exhaustion DoS: added a connection limit of 256 concurrent clients.
  • Information disclosure on delete: the full tuple slot is now zero-filled instead of only writing the tombstone ID.
  • Invalid record IDs: reject IDs <= 0.
  • Charset consistency: Tuple now uses explicit UTF-8 encoding.

Verification

  • ./gradlew jar builds successfully.
  • Smoke tests: 12/12 passed (INSERT, SELECT, UPDATE, DELETE, SELECT_ALL, duplicate key, malformed packet handling, server-alive checks).
  • Stress test: 100 sequential malformed packets handled without crash; server remained functional.

Closes #1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security audit: multiple vulnerabilities including remote DoS and data corruption

1 participant