Psi Beta Rho Practice #1
Winter Quarter 2023 - Week 2
PBR’s got spirit!!!
📣General Announcements 📣
👏Welcome back!👏
⛳️CTFs⛳️
🔨Projects🔨
💪New Practice Style💪
web | rev/pwn | crypto |
Benson & Jason | Alec & Andrew | Gary & Joshua |
Practice Focus:
Pyjails
Presented by Jason
What is a pyjail?
Real World Uses for Pyjails
Why You Should Learn Pyjails Anyway
Pyjail Basics
"Standard" Pyjail: No Builtins
Regaining Builtins
().__class__.__base__.__subclasses__()[-1].__init__.__globals__["__builtins__"]["breakpoint"]()
().__class__ -> tuple
tuple.__base__ -> object
object.__subclasses__() -> a list of every type
[-1] -> explained on next slide
cls.__init__ -> constructor
func.__globals__ -> globals for that function
__builtins__ is a global
hooray you got builtins again!
Why object.__subclasses__()[-1]
The __globals__ property will only exist on functions written in Python
This seems like a silly thing to mention until you consider that most of the builtins are written in C
Subclasses are listed in import order, so the ones at the start are all written in C
Most Important Thing
Fun Challenge
Treebox from GoogleCTF 2022: https://gist.github.com/Aplet123/59d23849f7cbbcffcb0d795129b2b00b
Writeup: https://ur4ndom.dev/posts/2022-07-04-gctf-treebox/
Or, try doing the standard pyjail but without using single or double quotes
Thanks for coming! :)