Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

RakNetDOS (!) #102

@8artek0v0

Description

@8artek0v0

RakNet DoS attack.

The problem lays in ACKs and NAKs system in function:
ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer

commit e97c4bb didn't fix it

Specially crafted packet can hang RakNet thread for quite a while or freeze it for good.

ReliabilityLayer.cpp

Line 736:
for (i=0; i<incomingAcks.ranges.Size();i++)
{
...
...
Line 746:
for (datagramNumber=incomingAcks.ranges[i].minIndex; datagramNumber >= incomingAcks.ranges[i].minIndex && datagramNumber <= incomingAcks.ranges[i].maxIndex; datagramNumber++)
}

and

Line 818:
for (i=0; i<incomingNAKs.ranges.Size();i++)
{
...
...
Line 831:
for (messageNumber=incomingNAKs.ranges[i].minIndex; messageNumber >= incomingNAKs.ranges[i].minIndex && messageNumber <= incomingNAKs.ranges[i].maxIndex; messageNumber++)
}

When ranges[i].minIndex = 0 and ranges[i].maxIndex = 0xFFFFFFFE then loop will be executed 4294967294 times. Which is a lot. What is more, a single packet can contain
even 200 "ranges" or more. So loop at line 746 and 818 going to be executed 200 * 4294967294 = 858993458800 times, because ranges.Size() = 200;
This can hang RakNet thread for a while, so no new incoming connections are going to be accepted and all peers already connected will timeout.

Special case:
incomingNAKs.ranges[i].minIndex = 0 and incomingNAKs.ranges[i].maxIndex = 0xFFFFFFFF then loop at line 818 will never end.

In this case RakNet thread will be trapped in an endless loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions