Utilizing Sybase for Lateral Movement
A couple of years ago I participated in a red-team exercise with a company involved in hardware R&D.
The company had a very strict password policy, and every computer had a randomized local adminsitrator account password and local SMB server disabled.
We managed to gain access to one developer but got stuck there. We did find one thing though: many of the developers had Sybase Adaptive SQL server installed on their systems as it was bundled by default with LabVIEW and Siemens Step 7, both in use by the target.
I installed LabVIEW and tried accessing it through the Adaptive SQL client. Looking through the connect dialog I notice something interesting: one of the options was “Start and connect to a database on another computer”:
When selecting this option you need to specify the DB filename. I tried specifying an SMB server and could and pressed “Connnect”. Amazingly, the target computer connected back over an SMB null session to the share I specified. I setup a Samba server that allows anonymous access and placed a DB file I crafted with credentials I specified during creation. This time I managed to connect and execute SQL statments against my server. What was more interesting, the account permissions and roles were set by the DB file and not by the host, so I could setup in advance in my DB to have an administrator role and then I could execute “xp_cmdshell” on the remote host.
We tried this in the field using ssh port forwarding back home on 445 and got access to most developer computers.
This was quiet a few years ago, but looking over the CVE DB for Sybase I don’t see any issue that sounds like that, so I guess if you encounter Step7 or LabVIEW during a pentest you now know what to do.