Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #4456

Closed
Open
Created Nov 13, 2011 by Damian Johnson@atagar

TorCtl Misparsing Escaped Cookie Paths

The proper handling for the cookie file paths are actually kinda complicated since it can contain escape characters ("Controllers MUST handle escape sequences inside this string." [1]). Functionally this means that its been processed by tor's "esc_for_log" function in 'common/util.c'.

TorCtl not only doesn't unescape paths, but also chokes if there's an escaped quote within it. For instance...

atagar@morrigan:~/Desktop/arm/src$ cat ~/.tor/torrc 
SocksPort 0
ControlPort 9051
CookieAuthentication 1

DataDirectory /tmp/my data"dir/

atagar@morrigan:~/Desktop/arm/src$ python
>>> from TorCtl import TorCtl
>>> conn = TorCtl.connect()
INFO[Sat Oct 29 10:46:55 2011]:Event loop received close message.
INFO[Sat Oct 29 10:46:55 2011]:Event loop received close message.
NOTICE[Sat Oct 29 10:46:55 2011]:Tor closed control connection. Exiting event thread.
NOTICE[Sat Oct 29 10:46:55 2011]:Tor closed control connection. Exiting event thread.
Failed to read authentication cookie (file doesn't exist): /tmp/my data\

For stem's handling of this see the 'CONTROL_ESCAPES' uses in: https://gitweb.torproject.org/stem.git/blob/HEAD:/stem/types.py#l39

Cheers! -Damian

[1] https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt#l960

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