SlideShare a Scribd company logo
Briefing for:
Hacking Windows Internals
Cesar CerrudoCesar Cerrudo
ArgenissArgeniss
www.appsecinc.com
Hacking Shared Sections
Shared Section definition
Using Shared Sections
Tools
Problems
Searching for holes
Exploitation
Conclusions
References
www.appsecinc.com
Shared Section
Basically a Shared Section is a portion of memory
shared by a process, mostly used as an IPC (Inter
Process Communication) mechanism.
Shared Memory.
File Mapping.
Named or Unnamed.
www.appsecinc.com
Using Shared Sections
Loading binary images by OS.
Process creation.
Dll loading.
Mapping kernel mode memory into user address space !?.
Used to avoid kernel transitions.
Sharing data between processes.
GDI and GUI data, pointers !?, counters, any data.
www.appsecinc.com
Using Shared Sections
Creating a shared section
HANDLE CreateFileMapping(
HANDLE hFile, // handle to file (file mapping)
//or 0xFFFFFFFF (shared memory)
LPSECURITY_ATTRIBUTES lpAttributes, // security
DWORD flProtect, // protection
DWORD dwMaximumSizeHigh, // high-order DWORD of size
DWORD dwMaximumSizeLow, // low-order DWORD of size
LPCTSTR lpName // object name (named)
//or NULL (unnamed)
);//returns a shared section handle
www.appsecinc.com
Using Shared Sections
Opening an existing shared section
HANDLE OpenFileMapping(
DWORD dwDesiredAccess, // access mode (FILE_MAP_WRITE
// FILE_MAP_READ, etc.)
BOOL bInheritHandle, // inherit flag
LPCTSTR lpName // shared section name
);//returns a shared section handle
www.appsecinc.com
Using Shared Sections
Mapping a shared section
LPVOID MapViewOfFile(
HANDLE hFileMappingObject, // handle to created/opened
// shared section
DWORD dwDesiredAccess, // access mode(FILE_MAP_WRITE
// FILE_MAP_READ, etc.)
DWORD dwFileOffsetHigh, // high-order DWORD of offset
DWORD dwFileOffsetLow, // low-order DWORD of offset
SIZE_T dwNumberOfBytesToMap // number of bytes to map
); //returns a pointer to begining of shared section memory
www.appsecinc.com
Using Shared Sections
Ntdll.dll Native API
NtCreateSection() Creates a new section
NtOpenSection() Opens an existing section
NtMapViewOfSection() Map a section on memory
NtUnmapViewOfSection() Unmap a section from memory
NtQuerySection() Returns section size
NtExtendSection() Change section size
www.appsecinc.com
Using Shared Sections
Mapping unnamed Shared Sections.
OpenProcess(PROCESS_DUP_HANDLE,...)
DuplicateHandle(...)
MapViewOfFile(...)
Need permissions on target process
www.appsecinc.com
Using Shared Sections
Demo
www.appsecinc.com
Tools
Process Explorer
Shows information about processes (dlls, handles, etc.).
WinObj
Shows Object Manager Namespace information (objects
info, permissions, etc.)
ListSS
Lists Shared Sections names (local and TS sessions).
DumpSS
Dumps Shared Section data.
TestSS
Overwrites Shared Section data (to detect bugs)
www.appsecinc.com
Problems
Input validation
Weak permissions
Synchronization
www.appsecinc.com
Problems
Input validation
Applications don't perform data validation before using the
data.
Processes trust data on shared sections.
www.appsecinc.com
Problems
Weak permissions
Low privileged users can access (read/write/change
permissions) shared sections on high privileged
processes (services).
Terminal Services (maybe Citrix) users can access
(read/write/change permissions) shared sections on local
logged on user processes, services and other user
sessions.
www.appsecinc.com
Problems
Weak permissions
Demo
www.appsecinc.com
Problems
Synchronization
Not built-in synchronization.
Synchronization must be done by processes in order to
not corrupt data.
There isn't a mechanism to force processes to
synchronize or to block shared section access.
Any process (with proper rights) can alter a shared
section data while another process is using it.
www.appsecinc.com
Problems
Synchronization
Communication between Process A and B
Proces
s
A
Proces
s
B
Proces
s
C
Shared
Section
2- Write
data.
3- Data
ready.
4- Replace
data.
5- Read data.
1- Send me
data.
www.appsecinc.com
Searching for holes
Look for shared sections using Process Explorer or
ListSS.
Attach a process using the shared section to a
debugger.
Run TestSS on shared section.
Interact with process in order to make it use
(read/write) the shared section.
Look at debugger for crashes :).
www.appsecinc.com
Searching for holes
Demo
www.appsecinc.com
Exploitation
Elevating privileges.
Reading data.
Altering data.
Shared section exploits.
Using shared sections on virus/rootkits/ etc.
www.appsecinc.com
Exploitation
Reading data.
From high privileged processes (services).
From local logged on user processes, services and other
sessions on Terminal Services.
This leads to unauthorized access to data.
www.appsecinc.com
Exploitation
Reading data.
Reading Internet Explorer cookies and history information.
(Demo)
www.appsecinc.com
Exploitation
Altering data.
On high privileged processes (services).
On local logged on user processes, services and other
sessions on Terminal Services.
This leads to arbitrary code execution, unauthorized
access, processes or kernel crashing (DOS).
www.appsecinc.com
Exploitation
Altering data.
IIS 5 DOS. (Demo)
www.appsecinc.com
Exploitation
Shared section exploits.
When overwriting shared section data allow us to take
control of code execution.
Some shared sections start addresses are pretty static on
same OS and Service Pack.
Put shellcode on shared section.
Build exploit to jump to shellcode on shared section at
static location.
www.appsecinc.com
Exploitation
Shared section exploits.
MS05-012 - COM Structured Storage Vulnerability
Exploit (Demo)
www.appsecinc.com
Exploitation
Using shared sections on virus/rootkits/etc.
Some shared sections are used by many processes
(InternatSHData used for Language Settings) others are used by
all processes :).
Write code to shared section and the code will be instantly mapped
on processes memory and also on new created processes.
Use SetThreadContext() or CreateRemoteThread() to start
executing code.
Similar to WriteProcessMemory() - SetThreadContext() technique
or DLL Injection.
www.appsecinc.com
Exploitation
Using shared sections on virus/rootkits/etc.
Some shared sections have execute access.
It would be possible to avoid WinXP sp2 NX .
www.appsecinc.com
Conclusions
Windows and 3rd. Party applications have a bunch of
Shared Section related holes.
These kind of holes will lead to new kind of attacks
“SSAtacks” (Shared Section Attacks) ;)
Microsoft forgot to include a Shared Sections audit on
the trustworthy computing initiative :).
Windows guts are rotten:).
www.appsecinc.com
References
MSDN
Programming Applications for MS Windows - Fourth
Edition
Process Explorer (www.sysinternals.com)
WinObj (www.sysinternals.com)
Rattle - Using Process Infection to Bypass Windows
Software Firewalls (PHRACK #62)
Crazylord - Playing with Windows /dev/(k)mem
(PHRACK #59)
Click to edit Master title style
Click to edit Master subtitle style
Briefing for:
FIN
• Questions?
• Thanks.
• Contact: sqlsec>at<yahoo>dot<com
• Argeniss – http://www.argenis.com

More Related Content

PDF
Technical Note - ITME: Running StADOSvr.exe as a Service
PPTX
TO Hack an ASP .NET website?
PPTX
PIE - The Programmable Infrastructure Environment
DOCX
Alfresco
PPTX
Hack ASP.NET website
PDF
Application security 101
PPT
Waffle at NYCJavaSig
PPTX
Windows Hacking
Technical Note - ITME: Running StADOSvr.exe as a Service
TO Hack an ASP .NET website?
PIE - The Programmable Infrastructure Environment
Alfresco
Hack ASP.NET website
Application security 101
Waffle at NYCJavaSig
Windows Hacking

Similar to amrapali builders@@@@hacking windows internals.pdf (20)

PPT
Hacking Windows IPC
PPTX
Top 20 Asp.net interview Question and answers
PPT
.NET Debugging Tips and Techniques
PPT
.Net Debugging Techniques
PDF
Solid-State diskA solid-state drive also known as a solid-state di.pdf
PPTX
MongoDB on Windows Azure
PPTX
Reversing & malware analysis training part 2 introduction to windows internals
PPTX
PPT
Nachos 2
PPT
Perfect Papers Software
PPTX
C# Security Testing and Debugging
PPTX
Ch 04 asp.net application
PPT
Computer Systems Hardware
PPTX
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
PPT
08 Operating System Support
PPTX
Layering
PPTX
IDAPRO
PPTX
O porque das minhas aplicações funcionarem... E o que acontece com os recurso...
PPT
Operating system
PPT
SynapseIndia dotnet website security development
Hacking Windows IPC
Top 20 Asp.net interview Question and answers
.NET Debugging Tips and Techniques
.Net Debugging Techniques
Solid-State diskA solid-state drive also known as a solid-state di.pdf
MongoDB on Windows Azure
Reversing & malware analysis training part 2 introduction to windows internals
Nachos 2
Perfect Papers Software
C# Security Testing and Debugging
Ch 04 asp.net application
Computer Systems Hardware
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
08 Operating System Support
Layering
IDAPRO
O porque das minhas aplicações funcionarem... E o que acontece com os recurso...
Operating system
SynapseIndia dotnet website security development

More from amrapalibuildersreviews (20)

PDF
amrapali builders@@@hacking d link routers with hnap.pdf
PDF
Amrapali builders -- google cheatsheet.pdf
PDF
amrapali builders -- maroochy water-services-case-study briefing.pdf
PDF
amrapali builders -- hacking the genome.pdf
PDF
amrapali builders @@ hacking with basic command.pdf
PDF
amrapali builders @@ hacking challenges.pdf
PDF
amrapali builders @@ hardware hacking and robotics using the raspberry pi.pdf
PDF
amrapali builders @@ google hacking.pdf
PDF
amrapali builders @@hacking cctv.pdf
PDF
amrapali builders @@hacking printers.pdf
PDF
amrapali builders@@@bluetooth hacking.pdf
PDF
amrapali builders@@sub way hacking.pdf
PDF
amrapali builders@@hacking ciphers.pdf
PDF
Amrapali reviews(specification for amrapali titanium (low rise))Amrapali Buil...
PDF
Amrapali reviews(profile bn-basu)Amrapali Builders,Amrapali Group
PDF
Amrapali reviews(list-of-aproved-projects)Amrapali Builders,Amrapali Group
PDF
Amrapali reviews(application form 4 t ech park g.noida)Amrapali Builders,Am...
PDF
Amrapali reviews(doc-cmd)Amrapali Builders,Amrapali Group
PDF
Amrapali reviews(terrace homes)Amrapali Builders,Amrapali Group
PDF
Amrapali builders(terrace homes)Amrapali Reviews,Amrapali Group
amrapali builders@@@hacking d link routers with hnap.pdf
Amrapali builders -- google cheatsheet.pdf
amrapali builders -- maroochy water-services-case-study briefing.pdf
amrapali builders -- hacking the genome.pdf
amrapali builders @@ hacking with basic command.pdf
amrapali builders @@ hacking challenges.pdf
amrapali builders @@ hardware hacking and robotics using the raspberry pi.pdf
amrapali builders @@ google hacking.pdf
amrapali builders @@hacking cctv.pdf
amrapali builders @@hacking printers.pdf
amrapali builders@@@bluetooth hacking.pdf
amrapali builders@@sub way hacking.pdf
amrapali builders@@hacking ciphers.pdf
Amrapali reviews(specification for amrapali titanium (low rise))Amrapali Buil...
Amrapali reviews(profile bn-basu)Amrapali Builders,Amrapali Group
Amrapali reviews(list-of-aproved-projects)Amrapali Builders,Amrapali Group
Amrapali reviews(application form 4 t ech park g.noida)Amrapali Builders,Am...
Amrapali reviews(doc-cmd)Amrapali Builders,Amrapali Group
Amrapali reviews(terrace homes)Amrapali Builders,Amrapali Group
Amrapali builders(terrace homes)Amrapali Reviews,Amrapali Group

Recently uploaded (20)

PDF
.pdf is not working space design for the following data for the following dat...
PPTX
climate analysis of Dhaka ,Banglades.pptx
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
IB Computer Science - Internal Assessment.pptx
PDF
annual-report-2024-2025 original latest.
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Introduction to machine learning and Linear Models
PDF
Business Analytics and business intelligence.pdf
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
Mega Projects Data Mega Projects Data
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
.pdf is not working space design for the following data for the following dat...
climate analysis of Dhaka ,Banglades.pptx
Clinical guidelines as a resource for EBP(1).pdf
Data_Analytics_and_PowerBI_Presentation.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
IB Computer Science - Internal Assessment.pptx
annual-report-2024-2025 original latest.
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Introduction to machine learning and Linear Models
Business Analytics and business intelligence.pdf
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Mega Projects Data Mega Projects Data
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg

amrapali builders@@@@hacking windows internals.pdf