Skip to content

Hardcoded HEAP_BASE, LIBC_BASE, and PREREAD_HEAP_OFFSET do not work for all machines #4

@terry422

Description

@terry422

HEAP_BASE, LIBC_BASE, and PREREAD_HEAP_OFFSET in my machine are different than what is written in poc.py.

root@a44933714e16:/app# ps axf
    PID TTY      STAT   TIME COMMAND
     31 pts/1    Ss     0:00 bash
     43 pts/1    R+     0:00  \_ ps axf
      1 pts/0    Ss     0:00 /sbin/docker-init -- /app/entrypoint.sh
      7 pts/0    S+     0:00 nginx: master process /nginx-src/build/nginx -p /app -c /app/nginx.conf
      8 pts/0    S+     0:00  \_ python3 server.py
     10 pts/0    S+     0:00  \_ nginx: worker process
root@a44933714e16:/app# cat /proc/10/maps | grep heap
555555691000-5555556f6000 rw-p 00000000 00:00 0                          [heap]
5555556f6000-555555717000 rw-p 00000000 00:00 0                          [heap]
root@a44933714e16:/app# cat /proc/10/maps | grep libc.so
7ffff77b6000-7ffff77de000 r--p 00000000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6
7ffff77de000-7ffff7973000 r-xp 00028000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6
7ffff7973000-7ffff79cb000 r--p 001bd000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6
7ffff79cb000-7ffff79cc000 ---p 00215000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6
7ffff79cc000-7ffff79d0000 r--p 00215000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6
7ffff79d0000-7ffff79d2000 rw-p 00219000 00:2f 37364884                   /usr/lib/x86_64-linux-gnu/libc.so.6

Also, POST sprays also landed at different offsets, so I had to manually spray and find out the correct candidates.

Could be helpful if poc.py or README.md had some comments about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions