{"@attributes":{"version":"2.0"},"channel":{"title":"Beyonds on theevilbit blog","link":"https:\/\/theevilbit.github.io\/beyond\/","description":"Recent content in Beyonds on theevilbit blog","generator":"Hugo","language":"en","lastBuildDate":"Tue, 15 Oct 2024 00:00:00 +0000","item":[{"title":"Beyond the good ol' LaunchAgents - 35 - Persist through the NVRAM - The 'apple-trusted-trampoline'","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0035\/","pubDate":"Tue, 15 Oct 2024 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0035\/","description":"<blockquote>\n<p>This is part 35 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>TL;DR - This is a practically completely useless persistence, as this can be only set and enabled when SIP is actually disabled. On the other hand I still find it a pretty amazing way to persist, as we can do that by putting a binary into NVRAM and get that executed. Here follows the details of the discovery.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 34 - launchd boot tasks","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0034\/","pubDate":"Thu, 10 Oct 2024 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0034\/","description":"<blockquote>\n<p>This is part 34 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>The all mighty <code>launchd<\/code>, contains an embedded plist file in its <code>__TEXT __config<\/code> section, which contains various settings, BootStrap file locations (like <code>LaunchDaemons<\/code> and <code>LaunchAgents<\/code>) and it has also a <code>Boot<\/code> key, which defines various services, which will be run upon boot. They are called boot tasks. Although this is documented in Jonathan Levin&rsquo;s *OS Internals Vol I. book, I think this is a not well known, and in fact I also totally forgot about it until <a href=\"https:\/\/x.com\/byaaaaahhh\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Matt<\/a> brought them to my attention recently.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 33 - Widgets","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0033\/","pubDate":"Wed, 12 Jun 2024 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0033\/","description":"<blockquote>\n<p>This is part 33 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Widgets are application extensions you can place on your desktop to display some key information from your main app. Although Apple says developers shouldn&rsquo;t implement any functionality there and just use them as a display, they are still apps that run on their own and we can run code inside them. We will explore how we can create them, use them as persistence and also investigate what widgets will automatically run on our system.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 32 - Dock Tile Plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0032\/","pubDate":"Fri, 29 Sep 2023 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0032\/","description":"<blockquote>\n<p>This is part 32 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>When you write a series about something, there are some episodes which are less interesting, many boring stuff, but sometimes there are some true gems. While doing some research yesterday, I run into the Dock Tile Plugin feature in macOS, which turned out to be truly amazing from persistence point of view.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 31 - BSM audit framework","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0031\/","pubDate":"Fri, 26 May 2023 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0031\/","description":"<blockquote>\n<p>This is part 31 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>macOS implements the OpenBSM audit framework created by McAfee, which allows someone to audit system events, like login, file access, etc\u2026 This has been part of the system for very long time. Auditing has several components, the main one being the kernel, which handles all the events. The main user mode process is <code>auditd<\/code>, which is mainly responsible for logging. It\u2019s a huge framework, detailed very well by Jonathan Levin in his <code>*OS Internal Part 3<\/code> book. I suggest reading that part, but you can also find some information here:<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 30 - The man config file - man.conf","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0030\/","pubDate":"Wed, 10 May 2023 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0030\/","description":"<blockquote>\n<p>This is part 30 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>I was watching an old BSidesLuxemburg 2019 talk by Aaron Jewitt, called &ldquo;Threat Hunting On Linux And Mac With Auditbeat System Module&rdquo;, it&rsquo;s up on <a href=\"https:\/\/www.youtube.com\/watch?v=teq6r7XbBug\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>. Aaron mentioned in one of the slides that you can persist using <code>man.conf<\/code> files. It looked really odd, I tried to quickly Google it, but haven\u2019t found anything about it. So I took a look at the configuration file, and indeed, it turns out you can persist via man\u2019s configuration file, <code>man.conf<\/code>, which can be found at <code>\/private\/etc\/man.conf<\/code>.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 29 - amstoold","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0029\/","pubDate":"Tue, 08 Mar 2022 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0029\/","description":"<blockquote>\n<p>This is part 29 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>When doing some research on macOS I came across the following LaunchAgent: <code>\/System\/Library\/LaunchAgents\/com.apple.amstoold.plist<\/code>. Its content is the following.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-xml\" data-lang=\"xml\"><span style=\"display:flex;\"><span><span style=\"color:#099\">&lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#099\">&lt;!DOCTYPE plist PUBLIC &#34;-\/\/Apple\/\/DTD PLIST 1.0\/\/EN&#34; &#34;http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd&#34;&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#309;font-weight:bold\">&lt;plist<\/span> <span style=\"color:#309\">version=<\/span><span style=\"color:#c30\">&#34;1.0&#34;<\/span><span style=\"color:#309;font-weight:bold\">&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>EnablePressuredExit<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;true\/&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>EnableTransactions<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;true\/&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>Label<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;string&gt;<\/span>com.apple.amstoold<span style=\"color:#309;font-weight:bold\">&lt;\/string&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>LaunchEvents<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>com.apple.distnoted.matching<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>com.apple.nfcd.ams.accessory<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>Name<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;string&gt;<\/span>com.apple.nfcd.ams.accessory<span style=\"color:#309;font-weight:bold\">&lt;\/string&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>com.apple.notifyd.matching<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>com.apple.ams.privateListeningChanged<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>Notification<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;string&gt;<\/span>com.apple.ams.privateListeningChanged<span style=\"color:#309;font-weight:bold\">&lt;\/string&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>MachServices<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>com.apple.xpc.amstoold<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;true\/&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>ProcessType<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;string&gt;<\/span>Background<span style=\"color:#309;font-weight:bold\">&lt;\/string&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>ProgramArguments<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;array&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#309;font-weight:bold\">&lt;string&gt;<\/span>\/usr\/local\/bin\/amstoold<span style=\"color:#309;font-weight:bold\">&lt;\/string&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;\/array&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;key&gt;<\/span>RunAtLoad<span style=\"color:#309;font-weight:bold\">&lt;\/key&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#309;font-weight:bold\">&lt;true\/&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#309;font-weight:bold\">&lt;\/dict&gt;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#309;font-weight:bold\">&lt;\/plist&gt;<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>If we examine it closely we can notice that the related binary is <code>\/usr\/local\/bin\/amstoold<\/code>. This is very interesting as this file doesn&rsquo;t exists on default macOS installations. This means that if we create it, it will be started as the user upon login. As the launchd file is SIP protected, we can&rsquo;t even remove it, and even if we would, it likely would come back at the next OS update.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 28 - Authorization Plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0028\/","pubDate":"Wed, 09 Feb 2022 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0028\/","description":"<blockquote>\n<p>This is part 28 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This persistence mechanism was described in very detail by <a href=\"https:\/\/twitter.com\/xorrior\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Chris Ross<\/a> in his <a href=\"https:\/\/posts.specterops.io\/persistent-credential-theft-with-authorization-plugins-d17b34719d65\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">blogpost: Persistent Credential Theft with Authorization Plugins<\/a>. He also developed sample code, which can be found on his <a href=\"https:\/\/github.com\/xorrior\/macOSTools\/tree\/master\/auth_plugins\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">GitHub<\/a>. Thus this blog will only focus on the high level summary, and some changes that happened since he wrote that post.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 27 - Dock shortcuts","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0027\/","pubDate":"Tue, 08 Feb 2022 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0027\/","description":"<blockquote>\n<p>This is part 27 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This persistence is another gem I found in <a href=\"https:\/\/twitter.com\/_D00mfist\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Leo Pitt<\/a>&rsquo;s <a href=\"https:\/\/www.youtube.com\/watch?v=OFQYTJiAmxs\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Modern macOS Persistence<\/a> talk.<\/p>\n<p>macOS Dock stores shortcuts for applications, that we would like to access through the, well&hellip; Dock. It stores all settings in <code>~\/Library\/Preferences\/com.apple.dock.plist<\/code>. Although we can edit this PLIST directly, we can also use the <code>defaults<\/code> utility to change it. For example adding a new entry:<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 26 - Finder Sync Plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0026\/","pubDate":"Sat, 05 Feb 2022 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0026\/","description":"<blockquote>\n<p>This is part 26 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This method was documented very detailed by Patrick Wardle in his <a href=\"https:\/\/objective-see.com\/blog\/blog_0x11.html\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">blogpost<\/a> back in 2016. It was also covered by <a href=\"https:\/\/twitter.com\/_D00mfist\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Leo Pitt<\/a> in his <a href=\"https:\/\/www.youtube.com\/watch?v=OFQYTJiAmxs\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Modern macOS Persistence<\/a> talk, and he also made a POC, which can be found at his <a href=\"https:\/\/github.com\/D00MFist\/InSync\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">GitHub<\/a>. With there is really nothing to add here, so this post will be only a high level summary, for everything else refer to the above resources.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 25 - Apache2 modules","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0025\/","pubDate":"Wed, 15 Dec 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0025\/","description":"<blockquote>\n<p>This is part 25 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Possibly a less known feature that macOS has a built-in Apache2 web server, which can be enabled anytime. Just as other Apache2 servers, it also supports the load of custom modules, and this is what we will explore here briefly for persistence. For a detailed web server setup, I recommend the following articles:\n<a href=\"https:\/\/discussions.apple.com\/docs\/DOC-3083\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Setting up a local web server on a Mac - Apple Community<\/a>\n<a href=\"https:\/\/discussions.apple.com\/docs\/DOC-250004361\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Setting up a local web server on macOS 12\u2026 - Apple Community<\/a><\/p>"},{"title":"Beyond the good ol' LaunchAgents - 24 - Folder Actions","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0024\/","pubDate":"Thu, 02 Dec 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0024\/","description":"<blockquote>\n<p>This is part 24 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Folder action persistence has been documented by <a href=\"https:\/\/twitter.com\/its_a_feature_\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Cody Thomas<\/a> back in 2019 <a href=\"https:\/\/posts.specterops.io\/folder-actions-for-persistence-on-macos-8923f222343d\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">in his blog<\/a>. I think he did an awesome job, and everything he wrote still applies today. I wanted to take it a bit further and see if I can persist without any user prompts, and it turned out it is possible. I will also talk about its TCC implications.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 23 - emond, The Event Monitor Daemon","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0023\/","pubDate":"Sat, 27 Nov 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0023\/","description":"<blockquote>\n<p>This is part 23 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This post will be about <code>emond<\/code>, Apple&rsquo;s Event Monitor daemon.<\/p>\n<p>I think almost everything has been already told about this method and <code>emond<\/code> in general by James Reynolds <a href=\"http:\/\/magnusviri.com\/what-is-emond.html\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">here<\/a> and <a href=\"https:\/\/twitter.com\/xorrior\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">xorrior<\/a> <a href=\"https:\/\/www.xorrior.com\/emond-persistence\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">here<\/a> so really not much left for me. There is no point for me replicating their awesome posts, so please just read them. That&rsquo;s it! Thank you for reading! \u00af\\<em>(\u30c4)<\/em>\/\u00af\n.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 22 - LoginHook and LogoutHook","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0022\/","pubDate":"Wed, 24 Nov 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0022\/","description":"<blockquote>\n<p>This is part 22 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This method is considered deprecated by Apple, yet it still works.<\/p>\n<p>LoginHooks and LogoutHooks have been widely documented by many people, so this post is mostly for completeness. The official, Apple documentation can be found here: <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/MacOSX\/Conceptual\/BPSystemStartup\/Chapters\/CustomLogin.html#\/\/apple_ref\/doc\/uid\/10000172i-SW10-SW1\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Customizing Login and Logout<\/a><\/p>\n<p>LoginHooks and LogoutHooks are executed, well&hellip; at logins and logouts just as the name suggest, and they are run as root. They are set in the preferences of the  <code>com.apple.loginwindow<\/code> process, and so it&rsquo;s stored in the file <code>\/var\/root\/Library\/Preferences\/com.apple.loginwindow.plist<\/code>.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 21 - Re-opened Applications","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0021\/","pubDate":"Tue, 12 Oct 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0021\/","description":"<blockquote>\n<p>This is part 21 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This method was also documented by Patrick Wardle, in his original <a href=\"https:\/\/www.virusbulletin.com\/uploads\/pdf\/conference\/vb2014\/VB2014-Wardle.pdf\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Methods of Malware Persistence<\/a> white paper and also at <a href=\"https:\/\/attack.mitre.org\/techniques\/T1547\/007\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">MITRE ATT&amp;CK\u00ae<\/a>.<\/p>\n<p>When we restart macOS, we are presented with the following window:<\/p>\n<p><img src=\"https:\/\/theevilbit.github.io\/images\/beyond\/beyond_0021_0.png\" alt=\"Re-open Applications Prompt\"><\/p>\n<p>I guess, most users keep it selected, and then macOS will reopen all apps.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 20 - Terminal Preferences","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0020\/","pubDate":"Wed, 22 Sep 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0020\/","description":"<blockquote>\n<p>This is part 20 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This is another application specific persistence method, related to the Terminal application.<\/p>\n<p>In the Terminal Preferences, under the Profiles tab, we can set a command that will be executed upon Terminal&rsquo;s startup. This is shown in the screen below.<\/p>\n<p><img src=\"https:\/\/theevilbit.github.io\/images\/beyond\/beyond_0020_0.png\" alt=\"Terminal Profile Settings\"><\/p>"},{"title":"Beyond the good ol' LaunchAgents - 19 - Periodic Scripts","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0019\/","pubDate":"Fri, 06 Aug 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0019\/","description":"<blockquote>\n<p>This is part 19 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This post has been long due, as it&rsquo;s one of my favorite persistence tricks. Up until Big Sur 11.5 you could also exploit it for privilege escalation if Homebrew was installed on the system.<\/p>\n<p>Periodic scripts have a FreeBSD origin. These scripts are doing some maintenance tasks on the system, and scheduled to be run on a daily, weekly and monthly basis.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 18 - X11 and XQuartz","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0018\/","pubDate":"Mon, 28 Jun 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0018\/","description":"<blockquote>\n<p>This is part 18 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>I learned about <a href=\"https:\/\/www.xquartz.org\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">XQuartz<\/a> while reading Armin Briegel&rsquo;s <a href=\"https:\/\/books.apple.com\/hu\/book\/macos-terminal-and-shell\/id1550617226\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">\u200emacOS Terminal and shell<\/a> book. It&rsquo;s one of the alternative third party terminals we can install on macOS. As most terminals, this one also offers unique options to persist on the system.<\/p>\n<p>X11 used to be part of OS X, till 10.7, and it was open source, which we can find <a href=\"https:\/\/opensource.apple.com\/source\/X11server\/X11server-106.7\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 17 - Color Pickers","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0017\/","pubDate":"Mon, 31 May 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0017\/","description":"<blockquote>\n<p>This is part 17 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Color pickers??? It&rsquo;s this menu, where we can select a color:<\/p>\n<p><img src=\"https:\/\/theevilbit.github.io\/images\/beyond\/beyond_0017_0.png\" alt=\"\"><\/p>\n<p>To my surprise we can install our own color pickers on the system, and add custom ones. There are quite a few of these, some are even open source, like this: <a href=\"https:\/\/github.com\/viktorstrate\/color-picker-plus\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">GitHub - viktorstrate\/color-picker-plus: An Improved Color Picker for macOS<\/a>. Github is full of color picker codes, mostly written in Swift. We don&rsquo;t really need those, unless we want to be stealthy and hide our code inside a legitimate picker.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 16 - Screen Saver","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0016\/","pubDate":"Sun, 30 May 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0016\/","description":"<blockquote>\n<p>This is part 16 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Screen savers have been detailed recently by <a href=\"https:\/\/twitter.com\/_D00mfist\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Leo Pitt<\/a>on his <a href=\"https:\/\/posts.specterops.io\/saving-your-access-d562bf5bf90b\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">blog post: &ldquo;Saving Your Access&rdquo;<\/a>. Considering that he already wrote most of the interesting stuff, I will try to show some new information, but there will be some overlap.<\/p>\n<p>Screen savers are macOS bundles with the bundle extension of <code>.saver<\/code>. Their <code>Info.plist<\/code> file doesn&rsquo;t contain anything screen saver specific, so we can really use any bundle with the right extension.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 15 - xsanctl","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0015\/","pubDate":"Wed, 12 May 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0015\/","description":"<blockquote>\n<p>This is part 15 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>I run into this not so exciting persistent method when I was investigating <code>xsanctl<\/code> for&hellip; other&hellip; reasons&hellip; <code>xsanctl<\/code> is a &ldquo;Xsan file system control utility&rdquo;, which allows us to mount and manage Xsans.<\/p>\n<p>The <code>xsanctl<\/code> binary can be found at <code>\/System\/Library\/Filesystems\/acfs.fs\/Contents\/bin\/xsanctl<\/code>, however when we simply run the command it is run from <code>\/usr\/sbin\/xsanctl<\/code>. If we check, this is a symbolic link.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 14 - atrun","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0014\/","pubDate":"Tue, 27 Apr 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0014\/","description":"<blockquote>\n<p>This is part 14 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>The <code>at<\/code> command set is a heritage *nix job scheduler on macOS. Although it&rsquo;s slowly being deprecated, it&rsquo;s still available on Big Sur, although disabled by default.<\/p>\n<h2 id=\"enabling-atrun\">\n  Enabling atrun\n  <a class=\"heading-link\" href=\"#enabling-atrun\">\n    <i class=\"fa-solid fa-link\" aria-hidden=\"true\" title=\"Link to heading\"><\/i>\n    <span class=\"sr-only\">Link to heading<\/span>\n  <\/a>\n<\/h2>\n<p>As described by <code>atrun<\/code>&rsquo;s man page, the scheduler can be enabled using the following command:<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 13 - Audio Plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0013\/","pubDate":"Mon, 19 Apr 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0013\/","description":"<blockquote>\n<p>This is part 13 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This is another one of my favorites for some reason. macOS being a popular audio editing device, supports external audio drivers and plugins. <a href=\"https:\/\/twitter.com\/xorrior\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">@xorrior<\/a> wrote a very extensive blog post about these at his website, here: <a href=\"https:\/\/posts.specterops.io\/audio-unit-plug-ins-896d3434a882\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Audio Unit Plug-ins. Legitimate Un-signed Code Execution | by Christopher Ross | Posts By SpecterOps Team Members<\/a><\/p>"},{"title":"Beyond the good ol' LaunchAgents - 12 - QuickLook Plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0012\/","pubDate":"Mon, 05 Apr 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0012\/","description":"<blockquote>\n<p>This is part 12 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<h2 id=\"tldr\">\n  TL;DR\n  <a class=\"heading-link\" href=\"#tldr\">\n    <i class=\"fa-solid fa-link\" aria-hidden=\"true\" title=\"Link to heading\"><\/i>\n    <span class=\"sr-only\">Link to heading<\/span>\n  <\/a>\n<\/h2>\n<p>This technique is very similarly to Spotlight Importers, but heavily sandboxed. It\u2019s even more limited as the user need to specifically want to preview the file.<\/p>\n<h2 id=\"intro\">\n  Intro\n  <a class=\"heading-link\" href=\"#intro\">\n    <i class=\"fa-solid fa-link\" aria-hidden=\"true\" title=\"Link to heading\"><\/i>\n    <span class=\"sr-only\">Link to heading<\/span>\n  <\/a>\n<\/h2>\n<p>This will be a short post and it goes hand in hand with my <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_0011\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">previous one<\/a> that detailed the use of Spotlight Importers for persistence. Jonathan\u2019s book also details QuickLook plugins and <a href=\"https:\/\/twitter.com\/osxreverser\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">fG! (@osxreverser) on Twitter<\/a> also said that he used to play with this, so I decided to take a look as well.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 11 - Spotlight Importers","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0011\/","pubDate":"Sat, 03 Apr 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0011\/","description":"<blockquote>\n<p>This is part 11 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<h2 id=\"tldr\">\n  TL;DR\n  <a class=\"heading-link\" href=\"#tldr\">\n    <i class=\"fa-solid fa-link\" aria-hidden=\"true\" title=\"Link to heading\"><\/i>\n    <span class=\"sr-only\">Link to heading<\/span>\n  <\/a>\n<\/h2>\n<p>It works, but very limited due to heavy sandboxing, you can only read and copy files to your sandbox folder or consume some CPU power. If you have a way to escape sandbox then go for it, or could be used as part of a multi-part malware.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 10 - Application script files","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0010\/","pubDate":"Fri, 02 Apr 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0010\/","description":"<blockquote>\n<p>This is part 10 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>I started to explore to possibility of persisting on macOS through script files contained in an application. The basic idea is that if we find a script file, which is being executed by a given application, we can edit that script file, put our code inside, and wait for an execution. Such technique is highly dependent on the applications the user has installed, so I looked through first how rare \/ frequent is having such scripts inside applications. I started with the below searches:<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 9 - Preference Pane","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0009\/","pubDate":"Thu, 25 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0009\/","description":"<blockquote>\n<p>This is part 9 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Preference panes on macOS are plugins to the <code>System Preferences.app<\/code>. These panes can extend the functionality of the app, and typically allow you to modify configuration settings for your app. These admins are loaded when the user selects them, so they are not perfect from persistence point of view, as it requires user interaction, but can still be a thing.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 8 - Hammerspoon","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0008\/","pubDate":"Tue, 23 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0008\/","description":"<blockquote>\n<p>This is part 8 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This idea came from my colleague <a href=\"https:\/\/twitter.com\/dejandayoff\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">@dejandayoff<\/a>. It&rsquo;s another application specific persistence option, related to <a href=\"https:\/\/www.hammerspoon.org\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Hammerspoon<\/a>. The app is an automation tool, that allows macOS scripting through LUA scripting language. We can even embed full AppleScript code as well as run shell scripts.<\/p>\n<p>The app looks for a single file, <code>~\/.hammerspoon\/init.lua<\/code>, and when started the script will be executed. They have plenty of examples on their <a href=\"https:\/\/www.hammerspoon.org\/go\/#imessagesms\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Getting Started<\/a> page, and an extensive API <a href=\"https:\/\/www.hammerspoon.org\/docs\/index.html\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">documentation<\/a>.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 7 - xbar plugins","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0007\/","pubDate":"Mon, 22 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0007\/","description":"<blockquote>\n<p>This is part 7 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>This technique came from <a href=\"https:\/\/twitter.com\/bradleyjkemp\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">@bradleyjkemp<\/a> in one of his Twitter <a href=\"https:\/\/twitter.com\/bradleyjkemp\/status\/13743463128759787550\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">posts<\/a>.<\/p>\n<p><a href=\"https:\/\/github.com\/matryer\/xbar\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">xbar<\/a> is an application that can put the output of a script into the menubar. The scripts should be placed in <code>~\/Library\/Application\\ Support\/xbar\/plugins\/<\/code>. Standard shell scripts are supported, and so I tried the one listed on their GitHub page as an example.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 6 - SSHRC","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0006\/","pubDate":"Sun, 21 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0006\/","description":"<blockquote>\n<p>This is part 6 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>I learned about this trick from <a href=\"https:\/\/twitter.com\/0xdade\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">@0xdade<\/a> when he <a href=\"https:\/\/twitter.com\/0xdade\/status\/1373145566943711235\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">posted<\/a> it on Twitter.<\/p>\n<p>If we create a file in the user&rsquo;s HOME directory at <code>~\/.ssh\/rc<\/code> it will be executed prior to the user&rsquo;s login shell becomes available. The man page of <code>sshd<\/code> describes this in more detail.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 5 - Pluggable Authentication Modules (PAM)","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0005\/","pubDate":"Sat, 20 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0005\/","description":"<blockquote>\n<p>This is part 5 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Pluggable_authentication_module\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">PAM<\/a> originated from Red Hat Linux, but made its way to most *nix based system, including macOS. It&rsquo;s a modular system, that allows third party additions to various authentication related operations. I highly recommend checking out the <a href=\"https:\/\/docs.freebsd.org\/en\/articles\/pam\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">FreeBSD documentation<\/a> to get a full picture.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 4 - cron jobs","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0004\/","pubDate":"Thu, 18 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0004\/","description":"<blockquote>\n<p>This is part 4 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Cron\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">cron<\/a> is probably one of the most well known persistence mechanisms for macOS and basically any *nix operating system. It was originally developed for Unix back in 1975, and made its way to most platforms, which has Unix origins, like Linux, FreeBSD and thus macOS.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 3 - Login Items","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0003\/","pubDate":"Wed, 17 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0003\/","description":"<blockquote>\n<p>This is part 3 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>To clear up some expectations. The below tweet is not about this method, that is deferred for now. :)<\/p>\n<p><img src=\"https:\/\/theevilbit.github.io\/images\/beyond\/beyond_0003_0.png\" alt=\"Twitter\"><\/p>\n<p>Login items are probably one of the most well documented methods to persist on macOS. It&rsquo;s widely used by various application to launch themselves upon user login. These applications show up in the menubar most of the time.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 2 - iTerm2 startup","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0002\/","pubDate":"Tue, 16 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0002\/","description":"<blockquote>\n<p>This is part 2 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>If the first part was about <code>Terminal<\/code> and shell profiles, it&rsquo;s worth to mention <a href=\"https:\/\/iterm2.com\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">iTerm2<\/a>, which is a popular Terminal alternative on macOS. It&rsquo;s being used by many people, especially power users.<\/p>\n<p>When we start <code>iTerm2<\/code> it starts the same shell environment as <code>Terminal<\/code>,  and thus the same startup files apply here as well. However this application has an additional way to execute code.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - 1 - shell startup files","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_0001\/","pubDate":"Sun, 14 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_0001\/","description":"<blockquote>\n<p>This is part 1 in the series of &ldquo;Beyond the good ol&rsquo; LaunchAgents&rdquo;, where I try to collect various persistence techniques for macOS. For more background check the <a href=\"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">introduction<\/a>.<\/p>\n<\/blockquote>\n<p>Shell startup files are executed when our shell environment like <code>zsh<\/code> or <code>bash<\/code> is starting up. macOS defaults to <code>\/bin\/zsh<\/code>  these days, and whenever we open <code>Terminal<\/code> or SSH into the device, this is the shell environment we are placed into. <code>bash<\/code> and <code>sh<\/code> are still available, however they have to be specifically started.<\/p>"},{"title":"Beyond the good ol' LaunchAgents - Introduction","link":"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/","pubDate":"Sun, 14 Mar 2021 00:00:00 +0000","guid":"https:\/\/theevilbit.github.io\/beyond\/beyond_intro\/","description":"<p>I was always amazed by <a href=\"https:\/\/twitter.com\/Hexacorn\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">@Hexacorn<\/a>&rsquo;s <a href=\"https:\/\/www.hexacorn.com\/blog\/category\/autostart-persistence\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">Beyond good ol&rsquo; Run key<\/a> blog post series, which collects various <a href=\"https:\/\/attack.mitre.org\/tactics\/TA0003\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">persistence<\/a> methods on Windows. It&rsquo;s an awesome series, which has 133 parts at the time of this writing. I find them pretty cool, and if you are doing either offensive or defensive work on Windows, this is  a must read and follow blog.<\/p>\n<p>In the past years as my interest in macOS grew, and now that I&rsquo;m mostly doing only macOS related research and studies I started to came across many - many tricks, which allows someone to do persistence on macOS beyond just the <code>LaunchDaemons<\/code> or <code>LaunchAgents<\/code> directories, which is used to store the <code>launchd<\/code> startup files. This location is probably as classic on macOS as the <code>Run<\/code> registry key on Windows. I did write about two different techniques in my regular posts (<a href=\"https:\/\/theevilbit.github.io\/posts\/macos_persistence_spotlight_importers\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">here<\/a> and <a href=\"https:\/\/theevilbit.github.io\/posts\/macos_persisting_through-application_script_files\/\"  class=\"external-link\" target=\"_blank\" rel=\"noopener\">here<\/a>), but it never became a full series. So I started to think about writing posts for each idea I came across, just like Adam does for Windows, but I would do for macOS. With almost the same name, just swapping <code>Run key<\/code> with <code>LaunchAgents<\/code> and name it <code>Beyond the good ol' LaunchAgents<\/code>.<\/p>"}]}}