Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #26060

Closed
Open
Created May 09, 2018 by Trac@tracbot

Invalid [Length] field when receiving RELAY cells via stem.client.Circuit

When receiving data via the stem.client.Circuit.send method, the current behavior is to unpack the RELAY cell before "repacking-it" in order to get a "raw bytes" representation of the ciphertext. The ciphertext is then decrypted and the cell repacked.

See https://gitweb.torproject.org/stem.git/tree/stem/client/__init__.py#n250

However, when a RELAY cell is unpacked, its [Length] field is used as-is: hence, a encrypted RELAY may see its content needlessly truncated. Note that here the original value of the [Length] field is not retained, thus we'll later be unable to retrieve it.

See https://gitweb.torproject.org/stem.git/tree/stem/client/cell.py#n347

Finally, when a RELAY cell is packed, the [Length] field is computed from the length of the data stored. As this field will later be decrypted, we have an invalid [Length] field for every RELAY cell we receive via the stem.client.Circuit send method.

See https://gitweb.torproject.org/stem.git/tree/stem/client/cell.py#n335

(note that was able to fix my local copy of stem by adding an extra keyword argument length=None to RelayCell's __init__ method that defaults to len(data) and by adding an extra keyword argument "encrypted" to RelayCell's _unpack class method that defaults to False in order to handle the discrepancy between the ciphertext/plaintext cases)

Trac:
Username: plcp

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None