{"vuid":"VU#840249","idnumber":"840249","name":"Wind River Systems VxWorks weak default hashing algorithm in standard authentication API (loginLib)","keywords":["scada","wrs"],"overview":"The hashing algorithm that is used in the standard authentication API for VxWorks is susceptible to collisions. An attacker can brute force a password by guessing a string that produces the same hash as a legitimate password.","clean_desc":"An attacker with a known username and access to a service (telnet, rlogin or FTP) that uses the standard authentication API (loginDefaultEncrypt (), part of loginLib) can brute force the password in a relatively short period of time. Since the hashing algorithm is susceptible to collisions, the actual password does not have to be found, just a string that produces the same hash. For instance, when the default 'target/password' login example is used, 'y{{{{{kS' hashes to the same string as 'password'. It is thus possible to login using both 'password' and 'y{{{{{kS' as the passwords for the user 'target'. Additional information can be found in ICS-CERT advisory ICSA-10-214-01 and on the Metasploit Blog.","impact":"An attacker can brute force a correct password by guessing a string that produces the same hash and access the relevant service as the known user.","resolution":"Vendors which use VxWorks in their products should not use the default hashing algorithm in standard authentication API (loginDefaultEncrypt()). A trusted authentication API should be used instead. It can be installed by means of the loginEncryptInstall() loginLib hook. In addition, and so as to avoid registration of the default 'target'/'password' credentials at init time, the LOGIN_USER_NAME and LOGIN_USER_PASSWORD project parameters/#defines should be set to empty strings (so that no user is registered using the default encryption routine). Only after the new encryption routine is registered should new users be added to the system. loginEncryptInstall allows the user to install a custom encryption routine. The custom routine <rtn> must be of the following form: STATUS encryptRoutine char *password,               /* string to encrypt    */\n       char *encryptedPassword       /* resulting encryption */ The <encryptedPassword> string length should be no more than : + VxWorks 6.4 and below: 80 characters\n+ VxWorks 6.5 and above: 128 characters When a custom encryption routine is installed, a host version of this routine must be written to replace the tool vxencrypt in host/<hostOs>/bin. Appendix #1 shows example code making use of loginEncryptInstall() to set a custom encryption routine. Depending on the VxWorks version used, either SHA-512 or SHA-256 are used. DISCLAIMER: The following example code was provided by Wind River Systems. It is for demonstration purposes only and should not be used as is. APPENDIX #1\n/* Sample loginEncryptInstallCode() */ /* includes */ #include <vxWorks.h>\n#include <errnoLib.h>\t/* for errnoGet API */\n#include <fcntl.h>\t/* for open API */\n#include <stdio.h>\t/* for sprintf API */\n#include <string.h>\t/* for string handling */\n#include <unistd.h>\t/* for close API */\n#include <loginLib.h>   /* library under test */\n#include <sysSymTbl.h>\t/* for sySymTbl variable */ /* globals */ * SHA-512 and SHA-256 digests corresponding to the 'vincent' string. * VxWorks 6.4 and below use SHA-256 because of the 80 chars\n * loginEncryptInstall() digest limit, while post 6.5 versions use SHA-512. #if ((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR > 4))\nchar * cryptSha = \"38256fbe4e80d9ffd355409f36238ae18e62c668208c259e60\"\n\t\t  \"ca323ab47cf55b8656e88e56593d531b250aae2c35376b387d\"\n\t\t  \"83ade5e3e8b6c042133b97030fa4\"; char * shaIdent = \"SHA-512\"; #else\nchar * cryptSha = \"65c3f75641b22925c737ca657b126cd68c39e423349d43031c\"\n\t\t  \"f9a3b9a18cee1f\"; char * shaIdent = \"SHA-256\"; #endif /* locals */ LOCAL STATUS fixed_sha (char* password, char* encryptedpassword); * loginEncryptInstallExample - register and use a custom encryption routine * RETURNS: N/A STATUS loginEncryptInstallExample (void) char* name = \"vincent\"; char* passwd = \"vincent\"; STATUS status = ERROR; /* Register our new encryption routine */ loginEncryptInstall (fixed_sha, 0); printf (\"Registered %s encryption routine.\\n\", shaIdent); /* Add a new user using this encryption routine */ if (loginUserAdd (name, cryptSha) != OK) printf (\"Unable to add new user to system using %s encryption\"\n\t\t\"routine [errno = %#x].\\n\", shaIdent, errnoGet ()); return ERROR; else /* Launch the verification process */ if (loginUserVerify (name, passwd) != OK) printf (\"Successfully registered and added a new user \"\n\t\t    \"with custom encryption routine but password \"\n\t\t    \"check failed [errno = %#x].\\n\", errnoGet ()); goto cleanup; else printf (\"Successfully used custom encryption routine \"\n\t\t    \"(routine registration, user creation and \"\n\t\t    \"verification).\\n\"); status = OK; cleanup: /* Remove user and module; unregister routine */ if (loginUserDelete (name, passwd) != OK) printf (\"There was a problem while trying to delete the \"\n\t\t\"newly added user during cleanup [errno = \" \"%#x].\\n\",\n\t\terrnoGet ()); status = ERROR; loginEncryptInstall ((FUNCPTR) loginDefaultEncrypt, 0); return status; * fixed_sha - returns a fixed SHA digest * RETURNS: Always OK LOCAL STATUS fixed_sha char* password,\n    char* encryptedpassword * IMPORTANT : This test routine should be replaced by a real SHA\n     * generator. Because of the fixed digest, the current version does not\n     * perform actual user validation (i.e all passwords are accepted for user\n     * 'vincent'). strcpy (encryptedpassword, cryptSha); return OK;","workarounds":"Restrict access\nAppropriate firewall rules should be implemented to restrict access to any services that use the standard authentication API. Disable services\nServices such as FTP or telnet should be disabled if not needed. Monitor access\nIDS signatures should be implemented to detect brute force attacks to services that use the standard authentication API.","sysaffected":"","thanks":"Thanks to HD Moore for reporting this vulnerability.","author":"This document was written by Jared Allar.","public":["https://community.rapid7.com/community/metasploit/blog/2010/08/02/shiny-old-vxworks-vulnerabilities","http://www.us-cert.gov/control_systems/pdf/ICSA-10-214-01_VxWorks_Vulnerabilities.pdf","http://blogs.windriver.com/chauhan/2010/08/vxworks-secure.html","https://support.windriver.com/olsPortal/faces/maintenance/downloadDetails.jspx?contentId=033709","http://newsoft-tech.blogspot.com/2010/09/follow-up-on-vxworks-issue.html","http://cvk.posterous.com/how-to-crack-vxworks-password-hashes","http://cwe.mitre.org/data/definitions/798.html","http://cwe.mitre.org/data/definitions/327.html","http://cwe.mitre.org/data/definitions/916.html"],"cveids":["CVE-2010-2967"],"certadvisory":"","uscerttechnicalalert":null,"datecreated":"2010-06-02T20:00:19Z","publicdate":"2010-08-02T00:00:00Z","datefirstpublished":"2010-08-02T12:59:25Z","dateupdated":"2014-06-02T20:31:54Z","revision":60,"vrda_d1_directreport":"1","vrda_d1_population":"4","vrda_d1_impact":"3","cam_widelyknown":"20","cam_exploitation":"0","cam_internetinfrastructure":"10","cam_population":"15","cam_impact":"20","cam_easeofexploitation":"10","cam_attackeraccessrequired":"14","cam_scorecurrent":"23.625","cam_scorecurrentwidelyknown":"23.625","cam_scorecurrentwidelyknownexploited":"39.375","ipprotocol":"","cvss_accessvector":"N","cvss_accesscomplexity":"L","cvss_authentication":null,"cvss_confidentialityimpact":"C","cvss_integrityimpact":"C","cvss_availabilityimpact":"C","cvss_exploitablity":null,"cvss_remediationlevel":"W","cvss_reportconfidence":"C","cvss_collateraldamagepotential":"ND","cvss_targetdistribution":"ND","cvss_securityrequirementscr":"ND","cvss_securityrequirementsir":"ND","cvss_securityrequirementsar":"ND","cvss_basescore":"10","cvss_basevector":"AV:N/AC:L/Au:N/C:C/I:C/A:C","cvss_temporalscore":"9.5","cvss_environmentalscore":"9.494769984","cvss_environmentalvector":"CDP:ND/TD:ND/CR:ND/IR:ND/AR:ND","metric":23.625,"vulnote":null}