MSSQL linked servers: abusing ADSI for password retrieval
MSSQL linked servers using the ADSI provider can be abused to retrieve cleartext passwords of linked logins or the current SQL login by pointing the LDAP query to an attacker-controlled host. An attacker with SQL access can capture the simple bind credentials sent by SQL Server.
Published on tarlogic.com
When we talk about Microsoft SQL Server linked servers, we usually think of links to another SQL Server instances. However, this is only one of the multiple available options, so today we are going to delve into the Active Directory Service Interfaces (ADSI) provider, which allows querying the AD using the LDAP…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the ADSI provider allows an arbitrary LDAP URL in the query, causing SQL Server to send credentials to an attacker-controlled server.
Impact
An attacker could obtain cleartext passwords of linked logins or the current SQL login, potentially leading to further compromise.
What the attacker needed
SQL access to the server; ADSI linked server exists or ALTER ANY LINKED SERVER…; attacker-controlled LDAP listener
How it was found
- Create or use an existing ADSI linked server.
- Execute a query using OPENQUERY with an LDAP URL pointing to an attacker-controlled machine.
- Capture the incoming LDAP simple bind request containing the cleartext password.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Microsoft SQL Server can link to other data sources, including Active Directory, using a feature called linked servers. When it connects to Active Directory, it sometimes sends the password in plain text. The report shows that by redirecting that connection to a machine the attacker controls, the attacker can capture the password.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.