Sunday, September 30, 2018

Disabling ARC4 Weak Algorithm (SSH Weak Algorithms Supported)



How to Mitigate SSH weak algorithm caused by ARC4 in 

OS: Redhat Linux

Description
Nessus / Open VAS has detected that the remote SSH server is configured to use the Arcfour stream cipher or no cipher at all. RFC 4253 advises against using Arcfour due to an issue with weak keys.

Solution:


To disable ARC4  go to /etc/ssh/sshd_config  and add the following entry 


# restrict ciphers to exclude arcfour
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc


Now restart the sshd 


 service sshd restart

 This should mitigate the identified vulnerability and remove RC4.

you can use the command  sshd -T |grep ciphers to check the current supported cipher versions running . 



Thursday, September 20, 2018

KB4088880: Windows Server 2012 March 2018 Security Update



Tenable Plugin : Plugin #108292


Tenable output

  The following registry keys need to be set to the appropriate values as dictated in ADV180002.
  This is required to enable the fix for CVE-2017-5715, CVE-2017-5753, and CVE-2017-5754:

  SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\FeatureSettingsOverride
  SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\FeatureSettingsOverrideMask
  SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\MinVmVersionForCpuBasedMitigations

  See KB Article 4072698 for more details.


Mitigation: 

 Mitigating this vulnerability requires you to make changes to the registry. Please backup your registry before any changes. Also the system needs to be restarted for the changes to take affect. Since this is Hyper V host specific, please shutdown all virtual machines in the host before shutdown.  Also if the Hyper V Host has clustering enabled , the live migration of hosts from the fixed registry Hyper V to Non Fix Hyper V host may fail. So it is recommended to apply the fix simultaneously in all clustered Hyper V hosts

To enable the fix:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f 


More details at

https://support.microsoft.com/en-us/help/4072698/windows-server-guidance-to-protect-against-the-speculative-execution

Note:

These posts are more focused towards being complaint in PCI and various other security scans. There are microcode available from respective chip vendors to mitigate this vulnerability but which is beyond the scop of this post  


Tuesday, September 11, 2018

Installing CA certificate to Windows Server 2016 for RDP


Installing CA certificate to Windows Server 2016 for RDP 




    As a part of PCI compliance  we recently had to use Certification Authority SSL certificates for RDP instead of the usual self signed certificate we were using. Also note that we did not have Remote desktop Gateway role installed in the server.

  

Installing certificates


Follow these steps to install the certificate by using the Microsoft Management Console (MMC) snap-in.

Start >Run>type in "MMC" Which opens the MMC console




On the Console menu, click Add/Remove Snap-in.




A choice to open the snap-in for the current user account, the service account, or for the computer account popups. Select the Computer Account and then Local Computer




Click on certificates in the left panel and click add


Click Close in the Add Standalone Snap-in dialog box.Click OK in the Add/Remove Snap-in dialog box. 



  • Use the MMC snap-in to install the certificate on the server:

    1. In the Certificates snap-in, in the console tree, expand Certificates (Local Computer), Right click personal>All tasks>import.

    Click next, next, and finish.
    Now you can see that the certificates has been imported an appears under the personal folder. 

    By default Windows Server takes the self signed certificate. We need to configure the RDP Listener to use the Imported Certificate. This can be achieved in 2 ways. Either using the WMI script or Using Registry Edit.


    WMI Method




    The  RDS listener configuration data for  is stored in the Win32_TSGeneralSetting class in WMI under the Root\CimV2\TerminalServices namespace. The thumbprint value is unique to each certificate. and is referenced by the SSLCertificateSHA1Hash property.



    Simple Powershell command to get the thumbprint value



    Get-Childitem Cert:\LocalMachine\My


    (the above command only works if a certificate has been previously imported to the personal folder using mmc snap-in)


         Copy the thumbprint hash value Run the below power shell command in admin mode substituting the highlighted thumbprint value with your thumbprint value of the new certificate.


    $path = (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'").__path

    Set-WmiInstance -Path $path -argument @{SSLCertificateSHA1Hash="thumbprintvalue"



    A successful completion of the command would look some thing like below.








    Once this is successfully executed new rdp connections to the server uses the new CA certificate.



    The Same can also be achieved by modifying the following registry values


    Registry path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
    Value name:  SSLCertificateSHA1Hash
    Value type:  REG_BINARY
    Value data:  certificate thumbprint



    Trouble Shooting :



















    Saturday, August 11, 2018

    VA SCAN: KB4088880: Windows Server 2012 March 2018 Security Update


    ISSUE:  
    Description
    The auditing Software Nessus/Others find Windows host is missing security update 4088880 or cumulative update 4088877 for systems which has already been patched.



    CVES: (CVE-2017-5715, CVE-2017-5753, CVE-2017-5754)(CVE-2018-0878)(CVE-2018-0929)(CVE-2018-0883)(CVE-2018-0881)(CVE-2018-0889, CVE-2018-0935)(CVE-2018-0811, CVE-2018-0813, CVE-2018-0814)(CVE-2018-0885)(CVE-2018-0886)(CVE-2018-0894, CVE-2018-0895, CVE-2018-0896, CVE-2018-0897, CVE-2018-0898, CVE-2018-0899, CVE-2018-0900, CVE-2018-0901, CVE-2018-0904)(CVE-2018-0868) (CVE-2018-0816, CVE-2018-0817) (CVE-2018-0888).


    Cause: The issue is often caused due to the fact that not only are the systems to be patched but some values to the registry needs to be manually added.

     a)SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\FeatureSettingsOverride

     b) SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\FeatureSettingsOverrideMask


    Solution: Please back up the registry in case you want to revert. Add the following commands in an administrative power shell.


    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 8 /f

    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

    A restart is required for the changes to take effect.




    Ref: KB Article 4072698


    Tenable Scan: Security Updates for Internet Explorer (June 2017)


     A High Vulnerability Alert Shows up in the Nessus Scan even after doing all the updates.





    Description
    The Internet Explorer installation on the remote host is missing security updates. It is, therefore, affected by multiple vulnerabilities :

    - A remote code execution vulnerability exists when Internet Explorer improperly accesses objects in memory.
    This vulnerability could corrupt memory in such a way that an attacker could execute arbitrary code in the context of the current user. (CVE-2017-8519, CVE-2017-8547)

    - A remote code execution vulnerability exists in the way JavaScript engines render when handling objects in memory in Microsoft browsers. The vulnerability could corrupt memory in such a way that an attacker could execute arbitrary code in the context of the current user. An attacker who successfully exploited the vulnerability could gain the same user rights as the current user. (CVE-2017-8517, CVE-2017-8522, CVE-2017-8524)

    Solution:

       Even though all updates have been done you need to manually change some registry settings in order to fully close this vulnerability.


    Please run this as admin in power shell

     reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_PRINT_INFO_DISCLOSURE_FIX" /v iexplore.exe /t REG_DWORD /d 1 /f

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_PRINT_INFO_DISCLOSURE_FIX" /v iexplore.exe /t REG_DWORD /d 1 /f


    Restart the machine and do a re scan with Nessus  and Vulnerability would appear as closed.



    Tuesday, October 31, 2017

    KB4025331: Windows Server 2012 July 2017 Cumulative Update


    Nessus Output :

    B4025331: Windows Server 2012 July 2017 Cumulative Update



    Description
    The remote Windows Server 2012 host is missing either the KB4025331 or KB4025343 security updates. It is, therefore, affected by the following vulnerabilities :

    - An information disclosure vulnerability exists in the Windows Performance Monitor Console due to improper parsing of XML input that contains a reference to an external entity. An unauthenticated, remote attacker can exploit this, by convincing a user to create a Data Collector Set and import a specially crafted XML file, to disclose arbitrary files via an XML external entity (XXE) declaration. (CVE-2017-0170)

    - A remote code execution vulnerability exists in Windows Explorer due to improper handling of executable files and shares during rename operations. An unauthenticated, remote attacker can exploit this, by convincing a user to open a specially crafted file, to execute arbitrary code in the context of the current user. (CVE-2017-8463)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8467)

    - An information disclosure vulnerability exists in Win32k due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to disclose sensitive information.
    (CVE-2017-8486)

    - A security bypass vulnerability exists in Microsoft Windows when handling Kerberos ticket exchanges due to a failure to prevent tampering with the SNAME field. A man-in-the-middle attacker can exploit this to bypass the Extended Protection for Authentication security feature. (CVE-2017-8495)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8556)

    - An information disclosure vulnerability exists in the Windows System Information Console due to improper parsing of XML input that contains a reference to an external entity. An unauthenticated, remote attacker can exploit this, by convincing a user to open a specially crafted file, to disclose arbitrary files via an XML external entity (XXE) declaration.
    (CVE-2017-8557)

    - An elevation of privilege vulnerability exists in the Windows kernel due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to execute arbitrary code with elevated permissions. (CVE-2017-8561)

    - An elevation of privilege vulnerability exists in the Windows due to improper handling of calls to Advanced Local Procedure Call (ALPC). An authenticated, remote attacker can exploit this via a specially crafted application, to run processes in an elevated context.
    (CVE-2017-8562)

    - An elevation of privilege vulnerability exists in Windows due to Kerberos falling back to NT LAN Manager (NTLM) Authentication Protocol as the default authentication protocol. An authenticated, remote attacker can exploit this, via an application that sends specially crafted traffic to a domain controller, to run processes in an elevated context. (CVE-2017-8563)

    - An information disclosure vulnerability exists in the Windows kernel due to improper initialization of objects in memory. An authenticated, remote attacker can exploit this, via a specially crafted application, to bypass Kernel Address Space Layout Randomization (KASLR) and disclose the base address of the kernel driver.
    (CVE-2017-8564)

    - A remote code execution vulnerability exists in PowerShell when handling a PSObject that wraps a CIM instance. An authenticated, remote attacker can exploit this, via a specially crafted script, to execute arbitrary code in a PowerShell remote session.
    (CVE-2017-8565)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8573)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics Component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8577)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8578)

    - An elevation of privilege vulnerability exists in the Microsoft Graphics Component due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode. (CVE-2017-8580)

    - An elevation of privilege vulnerability exists in Windows due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run arbitrary code in kernel mode.
    (CVE-2017-8581)

    - An information disclosure vulnerability exists in the HTTP.sys server application component due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, via a specially crafted request, to disclose sensitive information.
    (CVE-2017-8582)

    - A denial of service vulnerability exists in Windows Explorer that is triggered when Explorer attempts to open a non-existent file. An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to cause a user's system to stop responding. (CVE-2017-8587)

    - A remote code execution vulnerability exists in WordPad due to improper parsing of specially crafted files. An unauthenticated, remote attacker can exploit this, by convincing a user to open a specially crafted file, to execute arbitrary code in the context of the current user. (CVE-2017-8588)

    - A remote code execution vulnerability exists in the Windows Search component due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, by sending specially crafted messages to the Windows Search service, to elevate privileges and execute arbitrary code. (CVE-2017-8589)

    - An elevation of privilege vulnerability exists in the Windows Common Log File System (CLFS) driver due to improper handling of objects in memory. A local attacker can exploit this, via a specially crafted application, to run processes in an elevated context. (CVE-2017-8590)

    - A security bypass vulnerability exists in Microsoft browsers due to improper handling of redirect requests.
    An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to bypass CORS redirect restrictions. (CVE-2017-8592)

    - A remote code execution vulnerability exists in Microsoft browsers in the JavaScript engines due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to execute arbitrary code in the context of the current user. (CVE-2017-8606)

    - A remote code execution vulnerability exists in Microsoft browsers in the JavaScript engines due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to execute arbitrary code in the context of the current user. (CVE-2017-8607)

    - A remote code execution vulnerability exists in Microsoft browsers in the JavaScript engines due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to execute arbitrary code in the context of the current user. (CVE-2017-8608)

    - A remote code execution vulnerability exists in Microsoft Edge in the scripting engine due to improper handling of objects in memory. An unauthenticated, remote attacker can exploit this, by convincing a user to visit a specially crafted website, to execute arbitrary code in the context of the current user.
    (CVE-2017-8610)



    Solution
    Apply one of the following security updates :

    - KB4025331
    - KB4025343



    See Also

    Output
    •   The registry key "SYSTEM\CurrentControlSet\Services\NTDS\Parameters\LdapEnforceChannelBinding"
        is missing or is not equal to "1" or "2"
      
      


    Remediation : 

    Even after applying the update you will see that Nessus still detects it as an vulnerability. In order to fully mitigate it you need to create the following entries 


    To help make LDAP authentication over SSL\TLS more secure, administrators can configure the following registry settings:

    • Path for Active Directory Domain Services (AD DS) domain controllers: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NTDS\Parameters
    • Path for Active Directory Lightweight Directory Services (AD LDS) servers: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<LDS instance name>\Parameters
    • DWORD Name: LdapEnforceChannelBinding (Microsoft article has made a mistake and lists the DWORD Name as a Key which is incorrect )
    • DWORD value: 0 indicates disabled. No channel binding validation is performed. This is the behavior of all servers that have not been updated.
    • DWORD value: 1 indicates enabled, when supported. All clients that are running on a version of Windows that has been updated to support channel binding tokens (CBT) must provide channel binding information to the server. Clients that are running a version of Windows that has not been updated to support CBT do not have to do so. This is an intermediate option that allows for application compatibility.
    • DWORD value: 2 indicates enabled, always. All clients must provide channel binding information. The server rejects authentication requests from clients that do not do so.





    Monday, October 30, 2017

    Nessus :Microsoft XML Parser (MSXML) and XML Core Services Unsupported

    Microsoft XML Parser (MSXML) and XML Core Services Unsupported


    Description
    The remote host contains one or more unsupported versions of the Microsoft XML Parser (MSXML) or XML Core Services.

    Lack of support implies that no new security patches for the product will be released by the vendor. As a result, it is likely to contain security vulnerabilities.

    Note that support for MSXML 3.0 and 6.0 is based on the support policy of the operating system on which it is installed. Support for MSXML 5.0 is based on the Microsoft Office lifecycle policy.


    Solution
    Upgrade the software packages responsible for the unsupported DLL versions or upgrade to a supported version of Windows (Vista / 2008 or later). Alternatively, uninstall the outdated MSXML or XML Core Services.


    See Also


    Output
    •     Path               : C:\Windows\SysWOW64\msxml4.dll
          File version       : 4.20.9818.0
          XML Core version   : 4.0 Post SP3 (KB2758694)
          EOL date           : 2014/04/12
          EOL announcement   : https://support.microsoft.com/en-us/lifecycle/search/7921
          Supported versions : 5.20.1076 (Office 2007) / 6.0 or later on a supported version of
    • 
      
    • 
      
    •  Windows (Vista / 2008 or later).
      


    Resolution:

     In most cases these are unnecessary files and there are no good way to remove these . Browse to the C:\Windows\SysWOW64\msxml4.dll location .Copy the Msml14.dll to another location ( not necessary but as an insurance against eventualities ) and then delete the file or rename it.  Your next Nessus scan would show the issue as resolved . MSXML 4.0 is not needed for general OS usage and is no longer supported by Microsoft.
     


    Further reading


    SSH Weak MAC Algorithms Enabled on Huawei Switches & Routers

    Nessus / Qualys scan Description The remote SSH server is configured to allow either MD5 or 96-bit MAC algori...