Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.99k stars 1.7k forks source link

Some binary files cause `context.quiet` to affect the global scope. #2304

Closed the-soloist closed 10 months ago

the-soloist commented 10 months ago

The tested libc is download from https://github.com/niklasb/libc-database

Update Pwntools First

using latest commit

image

Debug Output

DEBUG output:

image

But when not using DEBUG, use ELF() load the target libc causes context.quiet to affect the global scope.

image

Test Code

testing on the following code

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwn import *
import ipdb

safe = "./libc6_2.13-20ubuntu5.2_i386.so"
target = "./libc6-x32_2.30-0ubuntu2_i386.so"

# load target libc
print("[test0] context.log_level: ", context.log_level)
ELF(target, checksec=False)
print("[test0] context.log_level: ", context.log_level)

# load safe libc in context.quiet
print("[test1] context.log_level: ", context.log_level)
with context.quiet:
    ELF(safe, checksec=False)
print("[test1] context.log_level: ", context.log_level)

# load target libc in context.quiet
print("[test2] context.log_level: ", context.log_level)
with context.quiet:
    ELF(target, checksec=False)
print("[test2] context.log_level: ", context.log_level)

Example File

attachment.zip

peace-maker commented 10 months ago

Thank you for the great test case!