{"id":8753,"date":"2023-09-29T23:18:54","date_gmt":"2023-09-29T23:18:54","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=8753"},"modified":"2023-09-29T23:29:19","modified_gmt":"2023-09-29T23:29:19","slug":"beyond-the-good-ol-bashrc-entry-part-1","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2023\/09\/29\/beyond-the-good-ol-bashrc-entry-part-1\/","title":{"rendered":"Beyond the good ol&#8217; .bashrc entry&#8230; Part 1"},"content":{"rendered":"\n<p>I really don&#8217;t know if this is the first post in the series, or just a one-off that is also, the last. There are many fantastic blog posts out there that deal with the most popular Linux persistence tricks, f.ex. <a href=\"https:\/\/pberba.github.io\/security\/2022\/02\/06\/linux-threat-hunting-for-persistence-initialization-scripts-and-shell-configuration\/\">here<\/a>. The latter is one of the best resources on Linux persistence that I know of, so I encourage everyone to read it first&#8230;.<\/p>\n\n\n\n<p>So, why starting something new, here?<\/p>\n\n\n\n<p>Truth be told that I was never the biggest user of Linux, but same as it is with macOS &#8211; their footprint is now so prominent that there is no escape \ud83d\ude09 So, since I am not an expert on Linux, this blog series (if it really happens) is about a different Linux&#8230; The non-expert-one. The year of Linux on the Desktop is probably still ahead of us, but there is already a lot of dumb-linux-user-level (like me) persistence opportunities in today&#8217;s desktop Linux versions that we can explore&#8230;<\/p>\n\n\n\n<p>Here&#8217;s the first one: The Terminal profile&#8230;<\/p>\n\n\n\n<p>One of the more interesting options offered by Terminal&#8217;s configuration panel is this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0.png\"><img decoding=\"async\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0.png\" alt=\"\" class=\"wp-image-8754\" width=\"600\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0.png 803w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0-300x128.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0-768x328.png 768w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_0-500x214.png 500w\" sizes=\"(max-width: 803px) 100vw, 803px\" \/><\/a><\/figure>\n\n\n\n<p>As it clearly says, you can set a custom command to execute when the terminal window is created under that given profile. A kinda stealth, conditional persistence, isn&#8217;t it?<\/p>\n\n\n\n<p>And what&#8217;s interesting about this configuration choice, apart from launching Gnome Calculator when you open a terminal in this profile (suggesting that any executable configured to execute from there could simply do its malicious thing first, then launch the shell so no one is the wiser&#8230;), is that the configuration of this setting is not preserved in a traditional way (inside an .ini or any familiar &#8216;linuxish&#8217; textual configuration file), but in a place that is a Linux cousin of Windows Registry: dconf&#8230;<\/p>\n\n\n\n<p>Now, one can install <a href=\"https:\/\/wiki.gnome.org\/Apps\/DconfEditor\">dconf-editor<\/a> to view these settings, but it complicates things. It&#8217;s very Windows-ish way of preserving the configuration data, after all.  Still that&#8217;s the easiest way to spot the bad guy:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1.png\"><img decoding=\"async\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1-1024x584.png\" alt=\"\" class=\"wp-image-8755\" width=\"600\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1-1024x584.png 1024w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1-300x171.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1-768x438.png 768w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1-500x285.png 500w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/09\/terminal_1.png 1312w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Is there an equivalent of RegShot for Linux today that can detect these changes in dconf?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I really don&#8217;t know if this is the first post in the series, or just a one-off that is also, the last. There are many fantastic blog posts out there that deal with the most popular Linux persistence tricks, f.ex. &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2023\/09\/29\/beyond-the-good-ol-bashrc-entry-part-1\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[35,19,78],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8753"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=8753"}],"version-history":[{"count":5,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8753\/revisions"}],"predecessor-version":[{"id":8765,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8753\/revisions\/8765"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=8753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=8753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=8753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}