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
Enhancing emotion recognition model for a student engagement use case through...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
Architecture types and enterprise applications.pdf
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PPTX
Configure Apache Mutual Authentication
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PPTX
The various Industrial Revolutions .pptx
PPT
Geologic Time for studying geology for geologist
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
Enhancing emotion recognition model for a student engagement use case through...
Hindi spoken digit analysis for native and non-native speakers
Zenith AI: Advanced Artificial Intelligence
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
UiPath Agentic Automation session 1: RPA to Agents
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Module 1.ppt Iot fundamentals and Architecture
Consumable AI The What, Why & How for Small Teams.pdf
Architecture types and enterprise applications.pdf
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Configure Apache Mutual Authentication
NewMind AI Weekly Chronicles – August ’25 Week III
Convolutional neural network based encoder-decoder for efficient real-time ob...
The various Industrial Revolutions .pptx
Geologic Time for studying geology for geologist
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Taming the Chaos: How to Turn Unstructured Data into Decisions

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]