Writing my thoughts...Started off very depressing…
"
I think this level was maybe the most frustrating and most terrifying. I still don’t fully understand it even after getting some help, a lot of things are still a blur. I think this shows and means a couple of things:
I still need more practice
Understanding what to expect is very crucial at least have an idea of what to expect
But humm I am not sure… I don’t think it is a skill problem
I have had a lot of moments throughout this journey that when I figure out something, something clicks… But so far I can’t even come up with an analogy…
My question just remained, WHY?? Why? Why is it like that ??
So until that question is answered I don’t think I will be satisfied. I understand what happened, how it happened, maybe I also know why it happened. But I don’t know, something is still missing. I think it is because I am not very familiar with certain tools and how they work. For example, how and why can I go from MORE, to vim / vi ? But also, vi is a text editor, why am I able to modify shells from there??
I think I get what happened… as I am walking through this in my head… Lemme see. So here is what I think happened.
And full disclosure I got the password by looking at someone else's answer, thank you to them but it was so incomplete, nonetheless they did help me…
So here is how it was set up, when I found out about “more” being replaced as PID 1, I realized in the back of my mind that it did take the role of the parent. One of the PID 1 roles is to reap processes or orphans, etc… But also, just like ChatGPT was pointing at, PID 1 has no parents. Therefore, if the program, the command, etc… sits on top as PID 1 and if it decides to exit, then the entire thing ends, there is nothing to fall back on, it is the root of the tree.
However, I can have child processes, it just happens to be that vi can be one of MORE child processes.
How did I find out about that ?
Well when access vi, set a shell and get a shell, once you exit, you fall back on guess what ? MORE… I was confused at first, and this explanation may be even more confusing, but it made at least something click: Anything can be PID 1, or at the top of the tree and control the rest of the things. Now, to navigate whatever is on top, you need to know how it works and I think that is one of the things I was missing.
""
Damn, I was going through it😂😂😂.
"
Why do I say that, well I have been familiar and been using a shell by default this whole entire time so I know how it works, I know I can type commands, I know I can see permissions etc… and you know what other capabilities that interactive shell gave me ?? an exit capability… I know how to exit, I know my way around it.
I don’t know if my own explanation makes sense so far but what I will remember is that having a shell is not a default behavior, you can decide what to have on top. Meaning I could literally write a program or put anything on top of the program and decide what goes and what doesn’t. But I think there is a limit to making anything PID 1 otherwise people wouldn’t be getting hacked…
I think this explanation makes sense to me and I think that is the “aha”, “click” moments that I was looking for:
I did not understand what was sitting at the top
I did not know how it works or how to navigate it.
I guess that is what they were saying about capabilities and stuff… Very interesting indeed… So I gotta learn more… I think I need to build something like that or reverse engineer something to completely understand it
REALIZATION: After reading chatGPT explanation:
OHHH So, in terms of security interaction is dangerous... If I can Interact then I will find a way to understand you and if I can understand you I can find a way to exploit your environment... That is why bash is very not safe. MORE you can interact with but unless you know how it works, you will feel stuck... And the other thing about MORE is that it doesn't really tell you much, you just kind of have to know it. It has commands that it agrees with but most of them are not your day to day type of commands, so you can feel lost and trapped... But the reality is very simple: YOU JUST DON'T KNOW HOW IT WORKS... How to interact with it... It was never about how to get to the flag, getting there is easy, here the top dog, top parent himself was a level of security, a maze, which is different from a default shell where you can get access then start protecting the rest...
OHHHHHH now the security network makes sense, I learned about it last time and I have started thinking as a defender as well... And I do remember mentioning that it is hard to separate your brain from an attacker mindset, trying to get to the flag, to a defender mindset... But part of learning that also taught me that the best security is not even letting anyone see the wall... So confusion is part of it. create a maze, you secure the whole thing, and this time it was from the top, most of the time it is okay to access the first layer, sure, here is a shell... But then certain things inside are protected by permission, this and that... But in this case, we are protecting that interactive shell that we are so used to because nothing there is secure. Maybe you just need to know certain syntax but other than that once you are passed that maze you are good... Damn... Pretty good
Wasn’t blocked by complexity — but blocked by language.
When nothing works, don’t try harder — change grammar.
""
Too many 💡💡
"
Project:
If I was a defender, how would I keep myself from finding this? OR better what would I do to confuse myself even more that I won’t even be able to think about something to research or look up. Build something that can make one think they have an idea, give enough clues to stir them in the wrong direction though… Clues to waste their time but at the same time every keystroke or attempt are recorded to alert me so I can change or build more safety… Build something simple enough that anybody can understand easily if explained but will waste time searching by themselves…
So what am I thinking about ?? a custom thing… Shell is very telling and leaks a lot of information. But I can’t build anything that big yet because I am still trying to learn, but this project should be small enough to not take an entire week for me to build it but big enough for me to understand how it works even deeper…
So what about we build a maze?”
Now I am probably not going to build it but it is a cool idea… maybe I will
“Question: If you write a program or an application, can you customize the navigation properties?? Or does it have to follow certain rules ??
What kind of program or app can sit on top of the tree? PID 1…
Maybe after this project after understanding this concept on a deeper level I can build something bigger, a maze inside of a maze… The only way out is to give up but the way in is fairly simple. However, create enough false routes to confuse you, just enough to waste a very big amount of time and at the same time capture all your attempts.
Then automate freshness… Once something is recorded or logged… switch mazes… Ohh How about creating 2-3 different mazes ? but each one switches based on the capabilities of the attacker ? This sounds cool so we can work towards building that… Maybe a smaller version first to be good and not die and burnout”
""
Well I watch too many movies... I am probably not building that but it sounds like a cool idea
Here is the solution (SPOILER):
"
I forgot to talk about something very important… So how do we even pass this level?? Damn I am still in shock or amaze how this thing can turn into such a maze that you get lost.
So the goal is to get you a shell.
So here is the process:
Make sure that your terminal screen is small enough to see about 2-3 lines, that will change the connection mode I think, to give you an interactive window for you to not get kicked out directly
Once you are inside, you will land on the “more” pager, now you gotta find a way to get a shell.
Luckily, we can invoke, or “more” is capable of spawning children and it can spawn vi(vim) text editors. The vi text editor is a very powerful text editor that gives you capabilities to write a file, edit, etc… Everything a text editor can do. It can also run commands, so the vi editor has two mode: To type and run command
So how do you get “vi” inside “more” pager? Just press “v” the keystroke will invoke the text editor.
-
From there you can run commands, and ask for a shell. How to do that, set the shell to whatever shell environment you are comfortable with. So run this command one after the other
:set shell=/bin/bash [ENTER]. This command will set the shell environment to bash ( pretty much the most popular or default shell for command lines). Then type
:shell[ENTER]. This command will take you out of the vi editor space to the command shell where you can run commands. Then do what you gotta do and find the password…
However, if you have been following, you will understand that we have entered 3 different spaces: the “more” pager, the vi text editor and now we are here, in the shell.
The relationship between those 3 spaces is of parent-child. So More → vi → shell… Now to exit this maze you gotta: shell → vi → More… that is the only way otherwise you are stuck, like I did.. SMH… Because I did not understand where I was, I got confused and got stuck and couldn’t leave.
So how to get out:
To leave the shell: this is the easiest part because we do this all the time, just : exit [ENTER]. Now remember, that is just one layer. When you exit the shell you fall back on vi. So it goes now vi → More
To exit vi: This is where I got stuck because I thought I was already inside more after exiting the shell… To exit vi:
Make sure you are in normal mode: Press ESC
From there you can exit vi with :q! ( to quit without saving )
:wq ( to save any changes then quit)
Or ZZ (shift+Z*2) Short cut to save and quit as well
After leaving the vi editor, only then you can leave more
To exit “more”: Just type “q”.
""
That is all.
But I will tell you what though? This is a hell of a way to learn about processes… I heard people saying they got stuck or broke their computer, I am pretty sure they met something like this…
So I read about processes and stuff, understood a bit how it works, so it is pretty fun
Please any feedback or was there a better way to solve this?
Lemme know how you would have solved this
Top comments (0)