SlideShare a Scribd company logo
Intercepting Windows Printing by Modifying GDI Subsystem by Artyom Shishkin, Positive Technologies
What for? Basically it’s a data source for Monitoring systems DLP solutions
What do we have ? FindNextPrinterChangeNotification( ): Printer name Timestamp Job status Pages count Print providOr is the source of this info, so I wouldn’t rely on it too much.
API levels Spooler Driver components
Driver components Print providers send jobs to a local or a remote machine A print processor converts the spooled data into a format suitable for a print monitor The print monitor passes the data to a port monitor A port monitor is an interface between the  usermode and the kernelmode parts of the printing system What a mess!
Using   XSS Implementation stages :  upload your JS file by means of   XSS; add the SCRIPT tag into the HEAD to upload the file dynamically; the commands are passed over according to the reverse shell principle; Use a standard AJAX to address the scripts on the localhost; Use JSONP to address the script backconnect;   Hide it in the IFRAME tag of the site.
Spooler API A set of Spooler service functions, which serve as wrappers for driver components At this level, we can only get the spooled data This is a level of raw printing Try to parse this data
GDI API The same set of functions used for Windows graphics A printer is a device context suitable for GDI drawing functions hPrinter = CreateDC(‘SuperLaserJet’, params); StartDoc(hPrinter); TextOut(hPrinter, ‘Text’); … Graphical data is Windows graphical data –  NT EMF format
Inside GDI Found with the help of PEB Thanks to Feng Yuan
The trick
Profit Swap GDI cells to send documents to a fake printer It is not always necessary to create your own virtual printer, you can use something like Microsoft XPS Writer The intercepted image can be easily forwarded to the original printer
GDI Printing Load the device context with CreateDC() Allows one to store devmode settings Start printing with StartDoc() Now we know when to perform magic Draw everything you want onto this device Let the application do the dirty work for us EndDoc() to finish printing DeleteDC() to clear the device context Clean everything up and wipe out the trails
The concept
Sample implementation
Thank you for your attention ! [email_address]

More Related Content

PDF
Artyom Shishkin - Printing interception via modifying Windows GDI
PPT
GTC 2009 OpenGL Gold
PDF
May Unplugged Mobile Controls User Group
PDF
GO and GCP: Introduction
PPTX
ab-initio-training basics and architecture
PDF
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
PPTX
Shape12 6
PDF
Virtual Network Computing Based Droid desktop
Artyom Shishkin - Printing interception via modifying Windows GDI
GTC 2009 OpenGL Gold
May Unplugged Mobile Controls User Group
GO and GCP: Introduction
ab-initio-training basics and architecture
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
Shape12 6
Virtual Network Computing Based Droid desktop

Similar to Intercepting Windows Printing by Modifying GDI Subsystem (20)

PPT
Lecture01
PPTX
3 App Compat Win7
PDF
An Introduction To Android
PPTX
Intro to Cuda
PDF
extend-existing-applications-with-the-leadtools-virtual-printer-sdk
PDF
A Gentle Introduction to GPU Computing by Armen Donigian
PPT
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
PPTX
Introduction.pptx
PPT
Porting and Maintaining your C++ Game on Android without losing your mind
DOC
Proyecto de microcontroladores
PPT
Ipc clipboard and data copy
PPTX
Computer
PDF
OpenGL Based Testing Tool Architecture for Exascale Computing
PPT
CS 354 Introduction
PDF
Taking Your FDM Application to the Next Level with Advanced Scripting
PDF
Chap 1 c++
PDF
Skiron - Experiments in CPU Design in D
PPTX
Windows 10 UWP Development Overview
PPT
Ab initio training Ab-initio Architecture
Lecture01
3 App Compat Win7
An Introduction To Android
Intro to Cuda
extend-existing-applications-with-the-leadtools-virtual-printer-sdk
A Gentle Introduction to GPU Computing by Armen Donigian
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
Introduction.pptx
Porting and Maintaining your C++ Game on Android without losing your mind
Proyecto de microcontroladores
Ipc clipboard and data copy
Computer
OpenGL Based Testing Tool Architecture for Exascale Computing
CS 354 Introduction
Taking Your FDM Application to the Next Level with Advanced Scripting
Chap 1 c++
Skiron - Experiments in CPU Design in D
Windows 10 UWP Development Overview
Ab initio training Ab-initio Architecture
Ad

More from Positive Hack Days (20)

PPTX
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
PPTX
Как мы собираем проекты в выделенном окружении в Windows Docker
PPTX
Типовая сборка и деплой продуктов в Positive Technologies
PPTX
Аналитика в проектах: TFS + Qlik
PPTX
Использование анализатора кода SonarQube
PPTX
Развитие сообщества Open DevOps Community
PPTX
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
PPTX
Автоматизация построения правил для Approof
PDF
Мастер-класс «Трущобы Application Security»
PDF
Формальные методы защиты приложений
PDF
Эвристические методы защиты приложений
PDF
Теоретические основы Application Security
PPTX
От экспериментального программирования к промышленному: путь длиной в 10 лет
PDF
Уязвимое Android-приложение: N проверенных способов наступить на грабли
PPTX
Требования по безопасности в архитектуре ПО
PDF
Формальная верификация кода на языке Си
PPTX
Механизмы предотвращения атак в ASP.NET Core
PDF
SOC для КИИ: израильский опыт
PDF
Honeywell Industrial Cyber Security Lab & Services Center
PDF
Credential stuffing и брутфорс-атаки
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Как мы собираем проекты в выделенном окружении в Windows Docker
Типовая сборка и деплой продуктов в Positive Technologies
Аналитика в проектах: TFS + Qlik
Использование анализатора кода SonarQube
Развитие сообщества Open DevOps Community
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Автоматизация построения правил для Approof
Мастер-класс «Трущобы Application Security»
Формальные методы защиты приложений
Эвристические методы защиты приложений
Теоретические основы Application Security
От экспериментального программирования к промышленному: путь длиной в 10 лет
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Требования по безопасности в архитектуре ПО
Формальная верификация кода на языке Си
Механизмы предотвращения атак в ASP.NET Core
SOC для КИИ: израильский опыт
Honeywell Industrial Cyber Security Lab & Services Center
Credential stuffing и брутфорс-атаки
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Spectroscopy.pptx food analysis technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
MIND Revenue Release Quarter 2 2025 Press Release
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectroscopy.pptx food analysis technology
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding

Intercepting Windows Printing by Modifying GDI Subsystem

  • 1. Intercepting Windows Printing by Modifying GDI Subsystem by Artyom Shishkin, Positive Technologies
  • 2. What for? Basically it’s a data source for Monitoring systems DLP solutions
  • 3. What do we have ? FindNextPrinterChangeNotification( ): Printer name Timestamp Job status Pages count Print providOr is the source of this info, so I wouldn’t rely on it too much.
  • 4. API levels Spooler Driver components
  • 5. Driver components Print providers send jobs to a local or a remote machine A print processor converts the spooled data into a format suitable for a print monitor The print monitor passes the data to a port monitor A port monitor is an interface between the usermode and the kernelmode parts of the printing system What a mess!
  • 6. Using XSS Implementation stages : upload your JS file by means of XSS; add the SCRIPT tag into the HEAD to upload the file dynamically; the commands are passed over according to the reverse shell principle; Use a standard AJAX to address the scripts on the localhost; Use JSONP to address the script backconnect; Hide it in the IFRAME tag of the site.
  • 7. Spooler API A set of Spooler service functions, which serve as wrappers for driver components At this level, we can only get the spooled data This is a level of raw printing Try to parse this data
  • 8. GDI API The same set of functions used for Windows graphics A printer is a device context suitable for GDI drawing functions hPrinter = CreateDC(‘SuperLaserJet’, params); StartDoc(hPrinter); TextOut(hPrinter, ‘Text’); … Graphical data is Windows graphical data – NT EMF format
  • 9. Inside GDI Found with the help of PEB Thanks to Feng Yuan
  • 11. Profit Swap GDI cells to send documents to a fake printer It is not always necessary to create your own virtual printer, you can use something like Microsoft XPS Writer The intercepted image can be easily forwarded to the original printer
  • 12. GDI Printing Load the device context with CreateDC() Allows one to store devmode settings Start printing with StartDoc() Now we know when to perform magic Draw everything you want onto this device Let the application do the dirty work for us EndDoc() to finish printing DeleteDC() to clear the device context Clean everything up and wipe out the trails
  • 15. Thank you for your attention ! [email_address]