Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Screenshot Detection by Modifying capture-screenshot.yml #1007

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
34 changes: 33 additions & 1 deletion collection/screenshot/capture-screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rule:
- [email protected]
- "@_re_fox"
- [email protected]
- "Abhyuday K Hegde"
scopes:
static: function
dynamic: span of calls
Expand All @@ -17,15 +18,18 @@ rule:
- BFB9B5391A13D0AFD787E87AB90F14F5:0x1314610A
- 7204e3efc2434012e13ca939db0d0b02:0x414070
- 50D5EE1CE2CA5E30C6B1019EE64EEEC2:0x406E07
- 0a30182ff3a6b67beb0f2cda9d0de678:0x407910
features:
- or:
# Classic GDI Capture
- and:
- or:
- api: user32.GetWindowDC
- api: user32.GetDC
- and:
- api: gdi32.CreateDC
- string: "DISPLAY"
- optional:
- string: "DISPLAY"
- or:
- api: gdi32.BitBlt
- api: gdi32.GetDIBits
Expand All @@ -43,3 +47,31 @@ rule:
- and:
- api: BitBlt
- api: System.Drawing.Graphics::CopyFromScreen
- and:
- api: "SelectObject"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api features do not require ". Please remove the " from this api feature and all that follow.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll remove the quotes!

- or:
- api: "BitBlt"
- api: "StretchBlt"
- api: "PrintWindow"
# GDI+ Graphics API chain
- and:
- api: "GdipCreateBitmapFromScan0"
- api: "GdipGetImageGraphicsContext"
- api: "GdipGetDC"
# Direct GDI+ screen copy
- and:
- api: "Gdiplus::Graphics::FromHDC"
- api: "Gdiplus::Graphics::CopyFromScreen"
Comment on lines +63 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be api or function-name features?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @mike-hunhoff !
According to my understanding, Gdiplus is not from a statically linked library right?

# DirectX method of screen capture
- and:
- or:
- api: "PrintWindow"
- api: "StretchBlt"
- and:
- api: "DwmGetDxSharedSurface"
- optional:
- string: "DXGI"
- or:
- api: "Direct3DCreate9"
- api: "IDirect3DDevice9::GetFrontBufferData"
Comment on lines +75 to +76
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be api or function-name features?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over here too, Direct3DCreate 9 is a direct import of a dll file right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, changing these features to function-name would require me to change the static scope of the rule to file. Would it not increase the number of false positives?

- string: "IDirect3DSurface9::GetDC"
Loading