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

Fix a hard to find problem in DeviceRedirection #422

Merged
merged 3 commits into from
Nov 15, 2022
Merged

Conversation

obilodeau
Copy link
Collaborator

Specific file transfers would hang. A minimal reproducer was hard to create. It turns out that the issue was in the encapsulation of the TLSSecurityLayer. If a virtual channel packet has a specific length (0x80), it would confuse the next layer into thinking it was the Security Header's licensing bytes causing the payload to be skipped from its usual processing.

See the recv() method of the TLSSecurityLayer class in pyrdp/layer/rdp/security.py.

Turns out that the security layer is not required if we are using modern RDP access mechanisms (anything more recent than RC4) so we can just remove the layer when the MITM is set up.

This fix happens to fix #139 as well.

Big shoutout to @xshill to help me dig for the root cause and fix the issue. Honorable mention to Flare Systems for letting me borrow him for one day last week.

Specifc file transfers would hang. A minimal reproducer was hard to create. It turns out that the issue was in the encapsulation of the TLSSecurityLayer. If a virtual channel packet at a specific length (0x80), it would confuse the next layer into thinking it was the Security Header's licensing bytes causing the payload to be skipped from its usual processing.

See the recv() method of the TLSSecurityLayer class in `pyrdp/layer/rdp/security.py`.

Turns out that the security layer is not required if we are using modern RDP access mechanisms (anything more recent than RC4) so we can just remove the layer when the MITM is setup.

This fix happens to fix #139 as well.
@obilodeau obilodeau added the bug Something isn't working label Nov 15, 2022
@obilodeau obilodeau added this to the v1.2.0 milestone Nov 15, 2022
@obilodeau obilodeau merged commit 6385d8a into master Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyRDP hangs when downloading a file of 108 bytes on the client's shared drive
1 participant