I agree to cookies for making this site function. By using this site, I agree to the Privacy Policy and Terms of Use.
Accept
HACKTORIAHACKTORIA
  • Home
  • Articles
    • CyberSecurity
    • OSINT
    • Networking
    • Programming
    • Software
    • Cloud
    • Crypto & Blockchain
    • Opinion
  • Monthly CTF
    • Challenges
      • The Mona Lisa Heist
      • Operation Mare Nostrum
      • Downtown Murderer
      • Operation Galaxios
      • Operation Brutus
      • Operation Runner
      • Operation Warthog
    • Storyline
      • April 2022 – Operation Galaxios
      • March 2022 – Operation Brutus
      • February 2022 – Operation Runner
      • January 2022 – Operation Warthog
    • Characters
    • Finishers 2022
    • Write-Ups
  • Practice
    • Fact Checking
      • Fact Checking 10
      • Fact Checking 9
      • Fact Checking 8
      • Fact Checking 7
      • Fact Checking 6
      • Fact Checking 5
      • Fact Checking 4
      • Fact Checking 3
      • Fact Checking 2
      • Fact Checking 1
    • Geolocation
      • Geolocation 32
      • Geolocation 31
      • Geolocation 30
      • Geolocation 29
      • Geolocation 28
      • Geolocation 27
      • Geolocation 26
      • Geolocation 25
      • Geolocation 24
      • Geolocation 23
      • Geolocation 22
      • Geolocation 21
      • Geolocation 20
      • Geolocation 19
      • Geolocation 18
      • Geolocation 17
      • Geolocation 16
      • Geolocation 15
      • Geolocation 14
      • Geolocation 13
      • Geolocation 12
      • Geolocation 11
      • Geolocation 10
      • Geolocation 9
      • Geolocation 8
      • Geolocation 7
      • Geolocation 6
      • Geolocation 5
      • Geolocation 4
      • Geolocation 3
      • Geolocation 2
      • Geolocation 1
    • Image Analysis
      • Image Analysis 16
      • Image Analysis 15
      • Image Analysis 14
      • Image Analysis 13
      • Image Analysis 12
      • Image Analysis 11
      • Image Analysis 10
      • Image Analysis 9
      • Image Analysis 8
      • Image Analysis 7
      • Image Analysis 6
      • Image Analysis 5
      • Image Analysis 4
      • Image Analysis 3
      • Image Analysis 2
      • Image Analysis 1
  • Videos
  • Art
  • About
    • Frank
    • Noureldin
    • Maria
    • Roxanna
    • Dipti
    • Joy
    • Oriana
    • Simone
    • Rudraksh
    • Amogh
    • Tony
Reading: How to gain ROOT Access on Linux?
Share
Aa
HACKTORIAHACKTORIA
Aa
Search
  • Home
  • Articles
    • CyberSecurity
    • OSINT
    • Networking
    • Programming
    • Software
    • Cloud
    • Crypto & Blockchain
    • Opinion
  • Monthly CTF
    • Challenges
    • Storyline
    • Characters
    • Finishers 2022
    • Write-Ups
  • Practice
    • Fact Checking
    • Geolocation
    • Image Analysis
  • Videos
  • Art
  • About
    • Frank
    • Noureldin
    • Maria
    • Roxanna
    • Dipti
    • Joy
    • Oriana
    • Simone
    • Rudraksh
    • Amogh
    • Tony
Follow US
© 2022 HACKTORIA
HACKTORIA > Articles > CyberSecurity > How to gain ROOT Access on Linux?
CyberSecurity

How to gain ROOT Access on Linux?

Oriana Olivetti
Oriana Olivetti June 7, 2022
Updated 2022/06/14 at 9:04 PM
Share
SHARE

Oh! Didn’t see you there. You may wonder how you can get root access as quick as the blink of an eye… So you are in the right place.

What do I mean by ‘root access’?

You may be familiar with the Windows’ Administrator account, that, like our root in Unix, is a superuser account designated for system administration purposes; meaning that it can perform any task without getting blocked due to the lack of sufficient permission.

Alright, let’s go to the fun part. Achieving the root user.

Let’s say you have access to a server, and you just need to get that juicy shadow file to perform a brute force attack.

So you are stuck in this poor low-privileged user called Simba (Just like my cat, what a coincidence!) and you try to see the shadow file on the server.

Oh shut! We don’t have enough permissions to see it! What can we do now?

Well, the sudo command has a –list option which will show us all the allowed and forbidden commands for the current user.

So let’s try it out!

As we can see, the interesting part is shown at the bottom of the command output. It says that simba, as a non root user, can execute 3 commands with root permissions. Have you found them already?

Find, less and vim commands, but they don’t seem to be harmful at all!

Not yet, but bear with me for a little longer. Now is the time when this amazing database full of binary commands comes into place.

As this page says, “GTFOBins is a curated list of Unix binaries that can be used to bypass local security restrictions in misconfigured systems.” And thanks to this list we can have an advantage to get our precious root privilege.

Let the fun begin

So, now having our sudo available commands, and the magic list, let’s see how we can make good use of them.

Let’s start with the vim binary. You can now try the privilege escalation yourself alongside simba.

1. Go to the GTFOBins page and look for the sudo section of the vim command.

2. There, you will see different commands with vim, that depending on the system, will give us the root access. For now, the (a) option is enough.

3. Time to try it on our console!

And just like a magic trick, we made Simba disappear and instead make the root account appear!

Will we be able to see the contents of the server’s shadow file now that we have gained root privileges? There is only one way to find out… and indeed, we now have in our hands what we wanted.

Want to keep hacking?

Let’s try it one more time with another command Simba has available.

This time, Simba will chose to exploit the find binary. So, again, we head to the https://gtfobins.github.io/ page to search for the find sudo section.

And now, will again try to exploit this in order to escalate privileges.

Incredibly simple, right?

Conclusion

So now, you and simba know how to gain root access when a low-privileged user have some binaries available to run as root due to security misconfigurations. It is time to play some CTFs with this trick up our sleeve!

Happy Hacking!

TAGGED: cybersecurity, ethicalhacking, hacking, infosec, linux, privesc, privilege escalation, root, security

Sign Up For our Weekly Digest

Receive a weekly digest of everything new on Hacktoria

By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Oriana Olivetti June 7, 2022
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

More from this Category

CyberSecurity

5 Days of HoneyPot Data: What did we catch?

15 Min Read
CyberSecurity

Getting Started with HoneyPots

16 Min Read
CyberSecurity

Microsoft MSDT Zero-Day (Follina/CVE-2022-30190)

3 Min Read
CyberSecurity

Cool infosec podcasts to listen to

6 Min Read

About Us

Hacktoria is a passion project run by volunteers.  We aim to create something we enjoy making that provides value to our readers, viewers and players. Our backgrounds vary from Information Technology, Cybersecurity to Data and Law.

Capture the Flag

We provide a Monthly Story Based Capture the Flag exercise. Players solve tasks using OSINT, Hacking, Social Engineering and Cryptographic skills to complete story driven missions. The winner of each competition is written into the fictional story. Participants receive a certificate of completion.

We also offer Practice Labs in various categories. These are intended to improve your investigative skills and provide a good dose of challenge and entertainment.

Articles & Videos

Besides CTF Exercises, our Editorial Team writes Articles about Cybersecurity, OSINT and Technology. We also host a YouTube channel that provides informative content and CTF material. This channel is hosted by Tony, aka “CyberVikingUK“.

HACKTORIAHACKTORIA
Follow US

© 2022 HACKTORIA - Capture the Flag Exercises & Cybersecurity, OSINT and Technology Articles

  • Sitemap
  • Privacy & Disclaimer
Join Us!

Subscribe to our weekly digest!

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Lost your password?