Skip to content

The Eclectic Light Company

Macs, painting, and more
Main navigation
  • Downloads
  • M1 & M2 Macs
  • Mac Problems
  • Mac articles
  • Art
  • Macs
  • Painting
hoakley November 12, 2018 Macs, Technology

Who put that in my Full Disk Access list? ssh and Mojave’s privacy protection

I apologise again for the interruption to my regular weekly article Last Week on My Mac, which appeared then disappeared yesterday. I’m still not quite sure what happened, but I had mistakenly concluded that Apple had changed the behaviour of the secure shell, ssh, with respect to privacy protection. Despite several sessions looking carefully at this, even studying the logs of both client and server during ssh connections, I was completely wrong.

For the avoidance of any doubt, Mojave 10.14.1 update hasn’t changed the behaviour of ssh with respect to privacy protection: if you enable Remote Login to your Mac in its Sharing pane, then anyone who gains access as a user using ssh can see all that user’s private data.

Whether this is a bug or a feature, I’ll leave you to judge when I explain how this works. It is particularly interesting, as it is one of the rare exceptions to the rule that only user interaction can modify the lists in Privacy: here, TCC adds its own item to the Full Disk Access list without any user warning or consent.

As far as access by the secure shell is concerned, Macs are in one of three states:

  • never accessed, and sshd-keygen-wrapper is absent from the Full Disk Access list;
  • accessed and permission granted, with sshd-keygen-wrapper listed and ticked;
  • accessed and permission now stopped, with sshd-keygen-wrapper listed but not ticked.

When you try to access that Mac using ssh, if it is in either of the first two states, macOS will automatically give ssh Full Disk Access. It is only when Privacy settings are in the last state that access to protected data will be refused. The only control that the user has is enabling and disabling the sshd-keygen-wrapper in the Full Disk Access list, which has the effect of toggling access to protected data for that user. Note that removing the sshd-keygen-wrapper item from the list sets it back to the first state, effectively enabling Full Disk Access: it does not prevent access to protected data at all.

With an ssh connection to a Mac, asking to list or view the contents of items which are not protected by TCC takes place through opendirectoryd and supporting services, and doesn’t involve TCC at all.

sshtake201

When you ask, for example to list the contents of the ~/Library/Calendars folder using ls, in the first instance a synchronous request is made to com.apple.tccd.system for the service kTCCServiceSystemPolicyAllFiles and function TCCAccessRequest. TCC constructs the attribution chain for this with the requester (REQ) as /usr/libexec/sandboxd, the access requested (ACC) as /bin/ls, and the responsible process (RESP) as /usr/sbin/sshd with a responsible path of /usr/libexec/sshd-keygen-wrapper.

sshd-keygen-wrapper is a tiny bit of code which is inevitably undocumented, and concerned with generating keys for ssh. It has in the past acted as a proxy for ssh/sshd in configuring firewalls, and here it also seems to act as a proxy for sshd.

The first time that you connect to a Mac using ssd, sshd-keygen-wrapper isn’t in the Full Disk Access list, which securityd complains about in the log:
could not enable test hierarchy: no UAT pinning preferences set
Presumably UAT pinning is the internal term for the user listings set in Privacy. This results in additional checking with securityd:
com.apple.TCC -[TCCDAccessIdentity staticCode]: static code for: identifier /usr/libexec/sshd-keygen-wrapper, type: 1: 0x7f86d7c5abc0 at /usr/libexec/sshd-keygen-wrapper
com.apple.securityd cert[2]: AnchorTrusted =(leaf)[force]> 0

and the result of the query with TCC is true – the access can go ahead, and sshd-keygen-wrapper is magically added to the Full Disk Access list by TCC.

This illustrates how, using current mechanisms, third party apps cannot add themselves to the Full Disk Access list, even with a user’s consent: to do so here requires TCC to have it on its defaults list, to recognise it as static code of a particular type (and presumably protected by SIP), and for securityd to confirm that it is signed by Apple.

sshtake202

The next time around, with sshd-keygen-wrapper in the Full Disk Access list, TCC authorises access direct from the allow list, which saves those couple of steps.

sshtake203

sshtake204

If you then disable (by unticking, not removal) sshd-keygen-wrapper in the Full Disk Access list, this first and most general request is refused:
kTCCServiceSystemPolicyAllFiles is denied.

sshtake205

TCC then tries a more specific access list, that for Calendars alone, with a synchronous request for the service kTCCServiceCalendar and function TCCAccessRequest. To that, TCC responds preflight_unknown, meaning that it doesn’t contain the expected information which could enable access to be granted, and sandbox then points out
kTCCServiceCalendar would require prompt by TCC for ls
In other words, this is a faceless command tool which would have required TCC to seek user consent.

sshtake206

As that is not possible here, the request fails.

TCC continues to try and repeats other requests, for the services kTCCServiceReminders, kTCCServiceCalendar, and eventually the sandbox reports
Sandbox: ls(44758) System Policy: deny(1) file-read-data /Users/hoakley/Library/Calendars
for the responsible sshd-keygen-wrapper stub.

sshtake207

If you then go on to try listing another protected folder, such as ~/Library/Mail, this process is shortcircuited, and the failure of the previous request is recognised:
Sandbox: 3 duplicate reports for ls deny(1) file-read-data /Users/hoakley/Library/Calendars
So the sandbox reports for that too
Sandbox: ls(44759) System Policy: deny(1) file-read-data /Users/hoakley/Library/Mail

This all looks excellent, and presuming that it’s robust, seems good to use. It has two significant issues, though, as far as I can tell:

  • The effect of removing sshd-keygen-wrapper from the Full Disk Access list is exactly the opposite of all other items in that list, in that (because of the default behaviour of ssh) it enables access rather than blocks it.
  • This is the only part of privacy protection in which the default is to allow, without any user warning or interaction.

Together these are inconsistent design which will lead to human error.

I also believe that none of the above is documented anywhere by Apple, which is a major omission for such a key command tool. As a minimum, Apple should document this in:

  • the man pages for ssh and sshd,
  • the user help for the Sharing pane,
  • the user help for the Privacy section of the Security & Privacy pane,
  • the full supporting documentation for privacy protection in Mojave, which merits a manual of its own.

Given the design issues noted above and the potential for user error, not to have drawn these to the attention of users and administrators is a serious omission.

Share this:

  • Twitter
  • Facebook
  • Reddit
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Related

Posted in Macs, Technology and tagged macOS 10.14, Mojave, privacy, Remote Login, ssh, sshd, TCC. Bookmark the permalink.

4Comments

Add yours
  1. 1
    Joss on November 12, 2018 at 11:52 am

    It works. Topmost is shell logged in via ssh with sshd-keygen-wrapper unticked (see pane), second shell is local with full disk access (iTerm in FDA & ticked).

    Question: sshd can remain ticked in the FDA list?

    LikeLiked by 1 person

    • 2
      hoakley on November 12, 2018 at 11:58 am

      As far as I can tell, adding ssh or sshd to the FDA list does nothing: it’s sshd-keygen-wrapper which controls access to the protected data. If you are ever going to use ssh into a Mac, you should be able to remove ssh and sshd from the FDA list, leaving just sshd-keygen-wrapper. When you want access to protected data, ensure that it’s ticked; when you don’t, simply untick it. But don’t remove it, as that will open up full access whether you want it or not.
      Howard.

      LikeLike

      • 3
        Joss on November 12, 2018 at 12:02 pm

        Thank you will. Will remove sshd. I don’t need full disk access via ssh (at least not at this time), so I’ll leave the wrapper unticked.

        LikeLiked by 1 person

  2. 4
    Who put that in my Full Disk Access list? ssh and Mojave’s privacy protection – The Eclectic Light Company – Jerry's Mac Blog on November 13, 2018 at 2:34 pm

    […] Source: Who put that in my Full Disk Access list? ssh and Mojave’s privacy protection – The Eclectic Lig… […]

    LikeLike

·Comments are closed.

Quick Links

  • Downloads
  • Mac Troubleshooting Summary
  • M1 & M2 Macs
  • Mac problem-solving
  • Painting topics
  • Painting
  • Long Reads

Search

Monthly archives

  • February 2023 (17)
  • January 2023 (74)
  • December 2022 (74)
  • November 2022 (72)
  • October 2022 (76)
  • September 2022 (72)
  • August 2022 (75)
  • July 2022 (76)
  • June 2022 (73)
  • May 2022 (76)
  • April 2022 (71)
  • March 2022 (77)
  • February 2022 (68)
  • January 2022 (77)
  • December 2021 (75)
  • November 2021 (72)
  • October 2021 (75)
  • September 2021 (76)
  • August 2021 (75)
  • July 2021 (75)
  • June 2021 (71)
  • May 2021 (80)
  • April 2021 (79)
  • March 2021 (77)
  • February 2021 (75)
  • January 2021 (75)
  • December 2020 (77)
  • November 2020 (84)
  • October 2020 (81)
  • September 2020 (79)
  • August 2020 (103)
  • July 2020 (81)
  • June 2020 (78)
  • May 2020 (78)
  • April 2020 (81)
  • March 2020 (86)
  • February 2020 (77)
  • January 2020 (86)
  • December 2019 (82)
  • November 2019 (74)
  • October 2019 (89)
  • September 2019 (80)
  • August 2019 (91)
  • July 2019 (95)
  • June 2019 (88)
  • May 2019 (91)
  • April 2019 (79)
  • March 2019 (78)
  • February 2019 (71)
  • January 2019 (69)
  • December 2018 (79)
  • November 2018 (71)
  • October 2018 (78)
  • September 2018 (76)
  • August 2018 (78)
  • July 2018 (76)
  • June 2018 (77)
  • May 2018 (71)
  • April 2018 (67)
  • March 2018 (73)
  • February 2018 (67)
  • January 2018 (83)
  • December 2017 (94)
  • November 2017 (73)
  • October 2017 (86)
  • September 2017 (92)
  • August 2017 (69)
  • July 2017 (81)
  • June 2017 (76)
  • May 2017 (90)
  • April 2017 (76)
  • March 2017 (79)
  • February 2017 (65)
  • January 2017 (76)
  • December 2016 (75)
  • November 2016 (68)
  • October 2016 (76)
  • September 2016 (78)
  • August 2016 (70)
  • July 2016 (74)
  • June 2016 (66)
  • May 2016 (71)
  • April 2016 (67)
  • March 2016 (71)
  • February 2016 (68)
  • January 2016 (90)
  • December 2015 (96)
  • November 2015 (103)
  • October 2015 (119)
  • September 2015 (115)
  • August 2015 (117)
  • July 2015 (117)
  • June 2015 (105)
  • May 2015 (111)
  • April 2015 (119)
  • March 2015 (69)
  • February 2015 (54)
  • January 2015 (39)

Tags

APFS Apple AppleScript Apple silicon backup Big Sur Blake bug Catalina Consolation Console diagnosis Disk Utility Doré El Capitan extended attributes Finder firmware Gatekeeper Gérôme HFS+ High Sierra history of painting iCloud Impressionism iOS landscape LockRattler log logs M1 Mac Mac history macOS macOS 10.12 macOS 10.13 macOS 10.14 macOS 10.15 macOS 11 macOS 12 macOS 13 malware Mojave Monet Monterey Moreau MRT myth narrative OS X Ovid painting Pissarro Poussin privacy realism Renoir riddle Rubens Sargent scripting security Sierra SilentKnight SSD Swift symbolism Time Machine Turner update upgrade Ventura xattr Xcode XProtect

Statistics

  • 13,811,490 hits
Blog at WordPress.com.
Footer navigation
  • About & Contact
  • Macs
  • Painting
  • Language
  • Tech
  • Life
  • General
  • Downloads
  • Mac problem-solving
  • Extended attributes (xattrs)
  • Painting topics
  • Hieronymus Bosch
  • English language
  • LockRattler: 10.12 Sierra
  • LockRattler: 10.13 High Sierra
  • LockRattler: 10.11 El Capitan
  • Updates: El Capitan
  • Updates: Sierra, High Sierra, Mojave, Catalina, Big Sur
  • LockRattler: 10.14 Mojave
  • SilentKnight, silnite, LockRattler, SystHist & Scrub
  • DelightEd & Podofyllin
  • xattred, Metamer, Sandstrip & xattr tools
  • 32-bitCheck & ArchiChect
  • T2M2, Ulbow, Consolation and log utilities
  • Cirrus & Bailiff
  • Taccy, Signet, Precize, Alifix, UTIutility, Sparsity, alisma
  • Revisionist & DeepTools
  • Text Utilities: Nalaprop, Dystextia and others
  • PDF
  • Keychains & Permissions
  • LockRattler: 10.15 Catalina
  • Updates
  • Spundle, Cormorant, Stibium, Dintch, Fintch and cintch
  • Long Reads
  • Mac Troubleshooting Summary
  • LockRattler: 11.0 Big Sur
  • M1 & M2 Macs
  • Mints: a multifunction utility
  • LockRattler: 12.x Monterey
  • VisualLookUpTest
  • Virtualisation on Apple silicon
  • LockRattler: 13.x Ventura
Secondary navigation
  • Search

Post navigation

Fog: Pissarro to Ury
Plutarch’s Lives in Paint: From Alexander the Great to Cato the Younger

Begin typing your search above and press return to search. Press Esc to cancel.

  • Follow Following
    • The Eclectic Light Company
    • Join 3,137 other followers
    • Already have a WordPress.com account? Log in now.
    • The Eclectic Light Company
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d bloggers like this: