exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Atstake Security Advisory 03-07-08.1

Atstake Security Advisory 03-07-08.1
Posted Jul 9, 2003
Authored by Atstake, Andreas Junestam | Site atstake.com

Atstake Security Advisory A070803-1 - By specifying the name of a named pipe instead of a file, as an argument to Microsoft SQL Server's xp_fileexist extended stored procedure, one can impersonate the user account Microsoft SQL Server is running under. This is due to the behavior of the CreateFile system call and Windows named pipe impersonation. This is not limited to Microsoft SQL Server, but a system wide problem.

tags | advisory
systems | windows
SHA-256 | a0e2cd066322faccbeda17b525edc1bfe19a840681e371d62018efeea6586415

Atstake Security Advisory 03-07-08.1

Change Mirror Download
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


@stake, Inc.
www.atstake.com

Security Advisory


Advisory Name: Named Pipe Filename Local Privilege Escalation
Release Date: 07/08/2003
Application: Microsoft SQL Server
Platform: Windows NT/2000/XP
Severity: Local privilege escalation
Author: Andreas Junestam (andreas@atstake.com)
Vendor Status: Fix available in Windows 2000 SP4
CVE Candidate: CAN-2003-0496 Named Pipe Filename Local Privilege
Escalation
Reference: www.atstake.com/research/advisories/2003/a070803-1.txt


Overview:

By specifying the name of a named pipe instead of a file, as an
argument to SQL Server's xp_fileexist extended stored procedure,
one can impersonate the user account Microsoft SQL Server is running
under. This is due to the behavior of the CreateFile system call and
Windows named pipe impersonation. This is not limited to Microsoft
SQL Server, but a system wide problem.


Detailed Description:

The API call CreateFile is used to open and/or create files, named
pipes, mail slots and much more. Today, there is no mechanism in
this API call to limit what kind of resource one want to open. This
is due to the fact that most resources are implemented as part of
the filesystem.

Most services in WIN32 are running under the local system account
and handling files in one way or another. If there exists a way
to specify which file a service should open, it is possible to
impersonate the account this service is running under. Additionally,
if UNC paths are used, there is no need to do a read operation on
the named pipe before it is possible to impersonate the client end
of the pipe.

This behaviour is easy to exploit in Microsoft SQL Server since
there are a large number of procedures where we can specify which
file to use. As an example, we will use xp_fileexist, an extended
stored proceudre that public can execute. By creating a named pipe
server with an arbitrary name and execute xp_fileexist with the
UNC name of the named pipe as an argument, one can impersonate the
user account SQL Server is running under.

Note that this is a system wide behaviour and not limited to
Microsoft SQL Server.

See the example section for an easy to follow example, which
describes the scenario.


Example:

Here follows a session which is cut-and-pasted from two
command shells. Mssqlpipe.exe is a program that creates a named
pipe, waits for a client to connect, and then impersonates
the client. It then executes the program specified on the
command line as the impersonated user.

- - From command shell #1:

C:\>mssqlpipe.exe cmd.exe
Creating pipe: \\.\Pipe\atstake
Pipe created, waiting for connectection
Connect to the database (with isql for example) and execute:
xp_fileexist '\\SERVERNAME\pipe\atsstake'

Then in command shell #2:

C:\>isql -U andreas
Password:
1> xp_fileexist '\\TEMP123\pipe\atstake'
2> go
File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
1 0 1

Then, back in command shell #1:

Impersonate user successful, we are running as user: SYSTEM


Vendor Response

Vendor first contacted on 06/21/2002
Vendor responded that they were working on fix: 07/08/2002
Vendor responded that fix would be in SP4: 10/02/2002

Vendor has fix in Windows 2000 SP4 available at:

http://www.microsoft.com/Windows2000/downloads/servicepacks/sp4/

The fix introduced a new user right in Windows 2000,
"Impersonate a Client AfterAuthentication". This permission
is only granted to Administrators and service accounts
by default. More information is available in the Microsoft
Knowledge Base:

http://support.microsoft.com/default.aspx?scid=kb;[LN];821546


@stake Recommendation

If you are running Windows 2000 you should install SP4.

SQL Server 2000 can run as a less privileged account than
SYSTEM which helps mitigate against this problem. Always
configure your servers to run as the least privileged
user account possible.


Credits:

Blake Watts (bwatts@securityinternals.com) for his Named Pipes
whitepaper "Discovering and Exploiting Named Pipe Security Flaws
for Fun and Profit".


Common Vulnerabilities and Exposures (CVE) Information:

The Common Vulnerabilities and Exposures (CVE) project has assigned
the following names to these issues. These are candidates for
inclusion in the CVE list (http://cve.mitre.org), which standardizes
names for security problems.

CAN-2003-0496 Named Pipe Filename Local Privilege Escalation


@stake Vulnerability Reporting Policy:
http://www.atstake.com/research/policy/

@stake Advisory Archive:
http://www.atstake.com/research/advisories/

PGP Key:
http://www.atstake.com/research/pgp_key.asc

@stake is currently seeking application security experts to fill
several consulting positions. Applicants should have strong
application development skills and be able to perform application
security design reviews, code reviews, and application penetration
testing. Please send resumes to jobs@atstake.com.

Copyright 2003 @stake, Inc. All rights reserved.




-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwquuUe9kNIfAm4yEQLPpACcDtshMFUb1AxNKppOa0xF9zGl99UAoMiS
X1mqnuKGNLGP+fRGGStgYfzp
=EeIn
-----END PGP SIGNATURE-----


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close