{"id":1746,"date":"2018-12-12T18:57:18","date_gmt":"2018-12-13T01:57:18","guid":{"rendered":"https:\/\/zed.inguardians.com\/?p=1746"},"modified":"2020-02-04T19:14:35","modified_gmt":"2020-02-05T02:14:35","slug":"attacking-and-defending-kubernetes-bust-a-kube-episode-1","status":"publish","type":"post","link":"https:\/\/zed.inguardians.com\/blog\/attacking-and-defending-kubernetes-bust-a-kube-episode-1\/","title":{"rendered":"Attacking and Defending Kubernetes: Bust-A-Kube – Episode 1"},"content":{"rendered":"
[et_pb_section bb_built=”1″][et_pb_row][et_pb_column type=”4_4″][et_pb_text]<\/p>\n
\n\t\t Kubernetes has become incredibly popular, particularly for DevOps teams who want to automate deployment, horizontal scaling, A\/B testing, and failure tolerance for an application. I’ve had quite a bit of fun compromising Kubernetes clusters in penetration tests, even as I read about illicit Kubernetes compromises, like that of Tesla, Inc.\u00a0 <\/span>In this blog post, I’ll show you how the students in my 2018 training classes compromised and then hardened an intentionally-vulnerable Kubernetes cluster. In the next episode, we’ll attack and defend a multi-tenant Kubernetes cluster.<\/span><\/p>\n We start by finding a vulnerable application, running in a Kubernetes cluster. Our target will be one of the Kubernetes documentation’s example applications, a Redis-backed Guestbook<\/a>, which has a small vulnerability, to which another has been added to give us remote code execution.<\/span><\/p>\n <\/p>\n Let\u2019s start by reading the source code (HTML and JavaScript) for this page. We see that this is an AJAX form, not a 1990’s style HTML form \u2013 clicking the submit button doesn\u2019t simply send a GET or POST request directly. Instead, the submit button calls JavaScript from the controller.js file to both pass the form in and update this page with output.<\/span><\/p>\n <\/p>\n This means we\u2019ll need to read controller.js to understand more about what\u2019s going on here. We pull down a copy of controller.js\u00a0<\/span>and see two functions.\u00a0 <\/span>Here\u2019s an excerpt from the first, which the submit button triggers:<\/p>\n <\/p>\n The JavaScript makes a GET request to guestbook.php, passing it these arguments:<\/span><\/p>\nCompromising the Application<\/span><\/h2>\n
CMD: set<\/span>\r\nKEY: messages<\/span>\r\nVALUE: the item we entered in the form\u2019s text box<\/span>\r\n<\/pre>\n