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

Possible security issue… #12

Closed
veryfoolish opened this issue Feb 16, 2012 · 2 comments
Closed

Possible security issue… #12

veryfoolish opened this issue Feb 16, 2012 · 2 comments

Comments

@veryfoolish
Copy link

Libtorrent allows an arbitrary number of leading zeros on bytestrings in Bencode decoding; I can see some potential for buffer overflow here. I.e., via a malicious tracker, peer, or Metainfo file.

Bytestrings should not have leading zeros ever because you'll never have a 0 length bytestring (although the Bittorrent 'spec' allows you to express something like i0e which is meaningless.

To recap:

d0000000000000000000000000000000000000000000000000000000000000000000000005:hello000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005:helloe

shouldn't be accepted. Modify a .torrent file and you'll see this works...

@deoxxa
Copy link

deoxxa commented Jun 15, 2012

How would that cause a buffer overflow exactly?

@rakshasa
Copy link
Owner

It can only really cause invalid re-encoded bencodes.

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

No branches or pull requests

3 participants