Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes ssecurityplain #440

Merged
merged 2 commits into from
Mar 30, 2017
Merged

Conversation

michalsrb
Copy link
Contributor

Two security fixes for SSecurityPlain.

Currently it proceeds only if there aren't enough data in queue and then it blocks waiting.
Also the required amount to receive from network is (ulen + plen), not (ulen + plen + 2).

This allowed not authenticated clients to deny service to everyone.
Setting the limit to 1024 which should be still more than enough.

Unlimited ulen and plen can cause various security problems:
  * Overflow in `is->checkNoWait(ulen + plen)` causing it to contine when there is not enough data and then wait forever.
  * Overflow in `new char[plen + 1]` that would allocate zero sized array which succeeds but returns pointer that should not be written into.
  * Allocation failure in `new char[plen + 1]` from trying to allocate too much and crashing the whole server.

All those issues can be triggered by a client before authentication.
@CendioOssman
Copy link
Member

I don't see where those two extra bytes are read. I see one readBytes() for ulen, and one for plen. So the existing code looks correct?

@michalsrb
Copy link
Contributor Author

The original code was:

if (is->checkNoWait(ulen + plen + 2))

It was missing the negation, so I corrected it to:

if (!is->checkNoWait(ulen + plen + 2))

And I created the pull request. But then I noticed that the formula is also incorrect so I removed the + 2:

if (!is->checkNoWait(ulen + plen))

Now I believe it is correct. I have modified the commit while it was waiting for pull, which is probably what caused the confusion, sorry about that.

@CendioOssman
Copy link
Member

Ah. I managed to look at the diff backwards somehow. I'll blame it on it being late here. ;)

@CendioOssman CendioOssman merged commit 62197c8 into TigerVNC:master Mar 30, 2017
@carnil
Copy link

carnil commented Apr 1, 2017

This has been assigned CVE-2017-7394

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.

None yet

3 participants