{"id":997,"date":"2022-09-23T19:34:14","date_gmt":"2022-09-23T09:34:14","guid":{"rendered":"https:\/\/catharsis.net.au\/blog\/?p=997"},"modified":"2022-09-23T19:51:19","modified_gmt":"2022-09-23T09:51:19","slug":"spawn-a-tty-shell","status":"publish","type":"post","link":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/","title":{"rendered":"Spawn a TTY Shell"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">There are several commands and things you can&#8217;t do if you have a non-tty-shell. This can occur if you upload reverse shells to a web server, resulting in a shell that is created by the user www-data or a user with a similar name.<br>As a result, you cannot use <code>su or sudo<\/code>, for instance, without a tty-shell. If you are able to obtain a root password but are unable to utilise it, this might be frustrating.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below are a few commands which can help you to have an interactive TTY shell:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.) python -c 'import pty; pty.spawn(\"\/bin\/sh\")'\n\n2.) echo os.system('\/bin\/bash')\n\n3.) \/bin\/sh -i\n\n4.) perl \u2014e 'exec \"\/bin\/sh\";'\n\n5.) perl: exec \"\/bin\/sh\";\n\n6.) ruby: exec \"\/bin\/sh\"\n\n7.) lua: os.execute('\/bin\/sh')\n\n8.)(From within IRB) - exec \"\/bin\/sh\"\n\n9.)(From within vi) - :!bash\n\n10.)(From within vi) - :set shell=\/bin\/bash:shell\n\n11.)(From within nmap) - !sh<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\"><em>Source: netsec.ws<\/em><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>This is for pure educational &amp; informational purpose. Only use these techniques where allowed or you have permission to do so. <\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>There are several commands and things you can&#8217;t do if you have a non-tty-shell. This can occur if you upload reverse shells to a web server, resulting in a shell that is created by the user www-data or a user with a similar name.As a result, you cannot use su or sudo, for instance, without [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1000,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,38],"tags":[55,57,56,58],"class_list":["post-997","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cve-exploits","category-how-to","tag-interactive-shell","tag-reverse-shell","tag-tty-shell","tag-upgrade-shell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spawn a TTY Shell - Catharsis | Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spawn a TTY Shell - Catharsis | Blog\" \/>\n<meta property=\"og:description\" content=\"There are several commands and things you can&#8217;t do if you have a non-tty-shell. This can occur if you upload reverse shells to a web server, resulting in a shell that is created by the user www-data or a user with a similar name.As a result, you cannot use su or sudo, for instance, without [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/\" \/>\n<meta property=\"og:site_name\" content=\"Catharsis | Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-23T09:34:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-23T09:51:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"480\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sajal Jain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sajal Jain\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/\"},\"author\":{\"name\":\"Sajal Jain\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#\\\/schema\\\/person\\\/f0826efb92a7aaf8d46b24715990e099\"},\"headline\":\"Spawn a TTY Shell\",\"datePublished\":\"2022-09-23T09:34:14+00:00\",\"dateModified\":\"2022-09-23T09:51:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/\"},\"wordCount\":118,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/tty-shell.png\",\"keywords\":[\"interactive shell\",\"reverse shell\",\"tty shell\",\"upgrade shell\"],\"articleSection\":[\"CVE &amp; Exploits\",\"How to\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/\",\"name\":\"Spawn a TTY Shell - Catharsis | Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/tty-shell.png\",\"datePublished\":\"2022-09-23T09:34:14+00:00\",\"dateModified\":\"2022-09-23T09:51:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/tty-shell.png\",\"contentUrl\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/tty-shell.png\",\"width\":900,\"height\":480,\"caption\":\"spawn-tty-shell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/spawn-a-tty-shell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spawn a TTY Shell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/\",\"name\":\"Catharsis | Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#organization\",\"name\":\"Catharsis | Blog\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/catharsis_au.jpg\",\"contentUrl\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/catharsis_au.jpg\",\"width\":215,\"height\":60,\"caption\":\"Catharsis | Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/#\\\/schema\\\/person\\\/f0826efb92a7aaf8d46b24715990e099\",\"name\":\"Sajal Jain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/Sajal-copy-96x96.jpg\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/Sajal-copy-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/Sajal-copy-96x96.jpg\",\"caption\":\"Sajal Jain\"},\"description\":\"Cyber Security Enthusiast | OSCP | CEH | CHFI | CNSS | Master of IT Security &amp; Master of IT Management\",\"url\":\"https:\\\/\\\/catharsis.net.au\\\/blog\\\/author\\\/sajal-jain\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spawn a TTY Shell - Catharsis | Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/","og_locale":"en_US","og_type":"article","og_title":"Spawn a TTY Shell - Catharsis | Blog","og_description":"There are several commands and things you can&#8217;t do if you have a non-tty-shell. This can occur if you upload reverse shells to a web server, resulting in a shell that is created by the user www-data or a user with a similar name.As a result, you cannot use su or sudo, for instance, without [&hellip;]","og_url":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/","og_site_name":"Catharsis | Blog","article_published_time":"2022-09-23T09:34:14+00:00","article_modified_time":"2022-09-23T09:51:19+00:00","og_image":[{"width":900,"height":480,"url":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png","type":"image\/png"}],"author":"Sajal Jain","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sajal Jain","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#article","isPartOf":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/"},"author":{"name":"Sajal Jain","@id":"https:\/\/catharsis.net.au\/blog\/#\/schema\/person\/f0826efb92a7aaf8d46b24715990e099"},"headline":"Spawn a TTY Shell","datePublished":"2022-09-23T09:34:14+00:00","dateModified":"2022-09-23T09:51:19+00:00","mainEntityOfPage":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/"},"wordCount":118,"commentCount":0,"publisher":{"@id":"https:\/\/catharsis.net.au\/blog\/#organization"},"image":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#primaryimage"},"thumbnailUrl":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png","keywords":["interactive shell","reverse shell","tty shell","upgrade shell"],"articleSection":["CVE &amp; Exploits","How to"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/","url":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/","name":"Spawn a TTY Shell - Catharsis | Blog","isPartOf":{"@id":"https:\/\/catharsis.net.au\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#primaryimage"},"image":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#primaryimage"},"thumbnailUrl":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png","datePublished":"2022-09-23T09:34:14+00:00","dateModified":"2022-09-23T09:51:19+00:00","breadcrumb":{"@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#primaryimage","url":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png","contentUrl":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2022\/09\/tty-shell.png","width":900,"height":480,"caption":"spawn-tty-shell"},{"@type":"BreadcrumbList","@id":"https:\/\/catharsis.net.au\/blog\/spawn-a-tty-shell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/catharsis.net.au\/blog\/"},{"@type":"ListItem","position":2,"name":"Spawn a TTY Shell"}]},{"@type":"WebSite","@id":"https:\/\/catharsis.net.au\/blog\/#website","url":"https:\/\/catharsis.net.au\/blog\/","name":"Catharsis | Blog","description":"","publisher":{"@id":"https:\/\/catharsis.net.au\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/catharsis.net.au\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/catharsis.net.au\/blog\/#organization","name":"Catharsis | Blog","url":"https:\/\/catharsis.net.au\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/catharsis.net.au\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2019\/01\/catharsis_au.jpg","contentUrl":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2019\/01\/catharsis_au.jpg","width":215,"height":60,"caption":"Catharsis | Blog"},"image":{"@id":"https:\/\/catharsis.net.au\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/catharsis.net.au\/blog\/#\/schema\/person\/f0826efb92a7aaf8d46b24715990e099","name":"Sajal Jain","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2019\/01\/Sajal-copy-96x96.jpg","url":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2019\/01\/Sajal-copy-96x96.jpg","contentUrl":"https:\/\/catharsis.net.au\/blog\/wp-content\/uploads\/2019\/01\/Sajal-copy-96x96.jpg","caption":"Sajal Jain"},"description":"Cyber Security Enthusiast | OSCP | CEH | CHFI | CNSS | Master of IT Security &amp; Master of IT Management","url":"https:\/\/catharsis.net.au\/blog\/author\/sajal-jain\/"}]}},"_links":{"self":[{"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/posts\/997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/comments?post=997"}],"version-history":[{"count":3,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/posts\/997\/revisions"}],"predecessor-version":[{"id":1005,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/posts\/997\/revisions\/1005"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/media\/1000"}],"wp:attachment":[{"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/media?parent=997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/categories?post=997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/catharsis.net.au\/blog\/wp-json\/wp\/v2\/tags?post=997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}