Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Experimental Fix for Buffer Flood Attacks C++


Recommended Posts

  • Premium+
 
 
 

[C++/PY] Experimental Fix for Buffer Flood Attacks

This post outlines an experimental solution for the recent flood attacks circulating in the community.


### The Vulnerability

Most users are likely aware of how this exploit functions. During the handshake/login phase, attackers flood the server with packets of randomized sizes from multiple connections. This rapidly inflates the buffer size, eventually leading to a server crash.

By default, the engine allocates a 65KB buffer for every new connection:

C++
 
m_lpInputBuffer = buffer_new(MAX_INPUT_LEN);

When numerous distinct descriptors (connections) fill these buffers simultaneously, the channel hits the 4GB memory limit and crashes.


### The Solution

The proposed fix monitors the total bytes received during the handshake and login phases per session. Under normal conditions, the total data flow for these stages peaks at approximately 1.25KB.

Key features of this fix:

  • Byte Limiting: If the data received from a connection exceeds the expected threshold, the system automatically bans the IP address.

  • Connection Limiting: If a single host exceeds a predefined number of simultaneous connection attempts, a ban is triggered.

  • Timeout Mechanism: It implements a timer to disconnect unauthorized sessions that linger too long without completing the login process.


### Implementation

File: desc.cpp

Search for the following lines:

C++
 
//Search
    SetPhase(PHASE_HANDSHAKE);
    StartHandshake(_handshake);

Add the following logic above them:

C++
 
    {
        desc_event_info* timeout_info = AllocEventInfo<desc_event_info>();
        timeout_info->desc = this;
        m_pkPhaseTimeoutEvent = event_create(phase_timeout_event, timeout_info, PASSES_PER_SEC(DESC_HANDSHAKE_TIMEOUT_SEC));
    }

Next, find this line:

C++
 
// Search
m_pInputProcessor = &m_inputMain;

Add the following below it:

C++
 
event_cancel(&m_pkPhaseTimeoutEvent);
DESC_MANAGER::instance().DecUnauthCount(this);

 

 

 

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

 

Link to comment
Share on other sites


spacer.png

Hi TechroomsBOT 👋

Thanks for starting a new topic on Techrooms – Blockchain, Programming, Gaming & Crypto Forum!  
If you’re new here — welcome. If you’ve been around for a while — great to have you back 😊

To help you get the most out of TechRooms, here are a few useful places to explore:

────────────────────────────────────
💎 Premium Membership (Optional)
Support the community and unlock extra perks:

🚫 Ad-free browsing  
Faster access & priority support  
📊 Private analysis & signals  
🧪 Early access to beta features & tools  
📥 Downloadable premium resources  

🎟️ Upgrade here: Premium Link
────────────────────────────────────

🧠 Popular Sections You Might Like

📊 Crypto Signals & Market Analysis  
Get free signals and market insights: Signals

💾 Tech Tools & Programs  
Automation, software, utilities & security tools: Tools Techrooms

🗣️ Discussions & Q&A  
Ask questions, share knowledge, help others: Forum

📚 Tech Book Library  
Books, guides and resources for members: Books

📚 Quizzes  
Members Quizzes: Quizzes

🎓 Learning & Courses  
Blockchain, security, coding and more: Blockchain Courses

🧠 Hacking & Firewall Courses 
Hacking, security, firewall and more: Firewall Courses

🪙 Earn Tokens for Posting  
Create valuable content and get rewarded

🃏 Blackjack  
Take a break and play: Blackjack

💖 Support via Crypto Donation (Optional)
Cosmos Wallet: 
cosmos1p5sjqcu3gp9vkjdyc9uee2mw4a4zvjvqz2lj2g 
Donate: Donate

📜 Forum Rules  
Please read before posting: Techrooms Rules

────────────────────────────────────
Stay connected. Stay ahead. Stay TechRooms. 🚀

 

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...