Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9da5c9936a | ||
|
|
ba1077b0c8 | ||
|
|
7997a5b895 | ||
|
|
6756fb5af6 | ||
|
|
3e078bf55f | ||
|
|
fab68f78fb | ||
|
|
af3694f0ef | ||
|
|
46c6f9037e | ||
|
|
31a552963f | ||
|
|
a2dc744551 | ||
|
|
868c11507c | ||
|
|
6fa9f7b09f | ||
|
|
cc261d6aaa | ||
|
|
5487b22a4f | ||
|
|
631eb1219a | ||
|
|
d3b327afc0 | ||
|
|
0fe3cf6682 | ||
|
|
1dbbb4a325 | ||
|
|
e0e562be5e | ||
|
|
844ad3b9ac | ||
|
|
6242a1f876 | ||
|
|
201ba2ef75 | ||
|
|
2c9eef4749 | ||
|
|
0f2d9a4dc1 | ||
|
|
8513bd9ac5 | ||
|
|
990640b79a | ||
|
|
e4dffe1d19 | ||
|
|
db9373b9f8 | ||
|
|
bfd686f940 | ||
|
|
2ef57de694 | ||
|
|
c76df05651 | ||
|
|
195def9964 | ||
|
|
7edaf1993f | ||
|
|
1a201a554a | ||
|
|
f11331d900 | ||
|
|
3f3d2d7c41 | ||
|
|
d4bc6b0a00 | ||
|
|
eb70525934 | ||
|
|
1f9042cb72 | ||
|
|
cf537b1488 | ||
|
|
af883f2f6e | ||
|
|
fc16fb4046 |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 322 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 634 KiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 607 KiB |
|
After Width: | Height: | Size: 564 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 607 KiB |
|
After Width: | Height: | Size: 548 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 506 KiB |
|
After Width: | Height: | Size: 582 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 601 KiB |
|
After Width: | Height: | Size: 685 KiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 315 KiB |
|
After Width: | Height: | Size: 525 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 572 KiB |
|
After Width: | Height: | Size: 538 KiB |
|
After Width: | Height: | Size: 627 KiB |
|
After Width: | Height: | Size: 533 KiB |
|
After Width: | Height: | Size: 560 KiB |
|
After Width: | Height: | Size: 541 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 316 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 947 KiB |
|
After Width: | Height: | Size: 978 KiB |
|
After Width: | Height: | Size: 982 KiB |
|
After Width: | Height: | Size: 972 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 925 KiB |
@@ -40,6 +40,12 @@ page = ["HTML", "RSS"]
|
||||
[pagination]
|
||||
pagerSize = 12
|
||||
|
||||
[markup]
|
||||
[markup.tableOfContents]
|
||||
endLevel = 4
|
||||
ordered = true
|
||||
startLevel = 2
|
||||
|
||||
[params]
|
||||
dateform = "Jan 2, 2006"
|
||||
dateformShort = "Jan 2"
|
||||
@@ -49,7 +55,7 @@ dateformMonth = "Jan, 2006"
|
||||
|
||||
# Metadata mostly used in document's head
|
||||
description = "Hey there, my name is Maik de Kruif, I create websites, bots and other kinds of software. At the moment, I'm still studying computer science at Avans University of Applied Sciences. I am also a big fan of open-source software, which is why you'll find many of my projects on Github. And last but not least, I love playing around with cyber-security related stuff."
|
||||
keywords = "Devloper, Software Engineer, Software Developer, Maik, Computer Science, Portfolio, Blog, Maik de Kruif"
|
||||
keywords = "Developer, Software Engineer, Software Developer, Maik, Computer Science, Portfolio, Blog, Maik de Kruif"
|
||||
images = [""]
|
||||
|
||||
genre = "Blog"
|
||||
@@ -58,7 +64,7 @@ rssLimit = 15
|
||||
|
||||
showReadingTimeInList = false
|
||||
|
||||
homeSubtitle = "Software Engineering, Linux and Cyber Security"
|
||||
homeSubtitle = "Software Engineer and Cyber Security Specialist"
|
||||
|
||||
# Prefix of link to the git commit detail page. GitInfo must be enabled.
|
||||
gitUrl = "https://github.com/maikka39/Personal-Website/commit/"
|
||||
@@ -125,9 +131,9 @@ image = "/img/home/portrait.png"
|
||||
twitter = "@maik_dev"
|
||||
|
||||
# Wallets
|
||||
[[params.wallets]]
|
||||
name = "XMR"
|
||||
address = "83cfsXGHPaW81hKJtAPYZEgbfFqANMTXXRwghsBpjf5oTDRV3BnCC4jFno8tLTnF4C6gJzGjPEmpvjntXaiGBB7kVitkDKi"
|
||||
# [[params.wallets]]
|
||||
# name = "XMR"
|
||||
# address = "83cfsXGHPaW81hKJtAPYZEgbfFqANMTXXRwghsBpjf5oTDRV3BnCC4jFno8tLTnF4C6gJzGjPEmpvjntXaiGBB7kVitkDKi"
|
||||
|
||||
# Social icons
|
||||
[[params.social]]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
author = "Maik de Kruif"
|
||||
title = "About"
|
||||
date = 2021-11-19T12:26:01+01:00
|
||||
description = "Ever since I was a little kid, I've loved coding. From the moment of writing my first program in Python and manipulating it to produce the desired output, I have been obsessed with the idea of writing software to solve practical problems. Programming is like a never-ending puzzle where you continuously have to come up with a new way to solve it."
|
||||
description = "I’m a passionate coder with a strong foundation in programming. With a love for solving practical problems through software development, I am driven to continuously explore new ways to create innovative solutions. My personal side-projects and exploration of cybersecurity further enhance my skills and dedication to building powerful and impactful applications."
|
||||
images = []
|
||||
tags = [
|
||||
"aboutme",
|
||||
@@ -10,12 +10,9 @@ tags = [
|
||||
categories = [
|
||||
"me",
|
||||
]
|
||||
toc = false
|
||||
+++
|
||||
|
||||
Ever since I was a little kid, I've loved coding. From the moment of writing my first program in Python and manipulating it to produce the desired output, I have been obsessed with the idea of writing software to solve practical problems. Programming is like a never-ending puzzle where you continuously have to come up with a new way to solve it.
|
||||
|
||||
Outside of my job, I run a small business with a couple of friends where we develop drone shows. I'm responsible for both designing and writing the control software as well as creating and designing the actual drones.
|
||||
|
||||
When I get home after work/school, I tend to either continue writing code for some personal side-projects, or play around with cyber-security related stuff. This is what keeps me up at night, a never-ending thirst to create beautiful, powerful things and share them with the world.
|
||||
|
||||
Skills/Interests: Python, Java, Scala, JavaScript, Node, CSS, HTML, Git, SQL, MongoDB, Apache, Nginx, Docker.
|
||||
When I get home after work, I tend to either continue writing code for some personal side-projects, or play around with cyber-security related stuff. Occasionally, I can also be found working on electronics projects. This is what keeps me up at night, a never-ending thirst to create beautiful, powerful things and share them with the world.
|
||||
|
||||
@@ -25,7 +25,6 @@ During one of his earlier videos, LiveOverflow challenged his viewers to find th
|
||||
|
||||
In LiveOverflow's eighth video, [he told his viewers that the server has been opened to the public](https://youtu.be/QradKmQ27JY?t=1246). I immediately started looking for ways to find it. After researching for a while, I found multiple ways to find it, but I thought they would all take a fair bit of time (I'll get back to this later). So, instead of spending time actually learning stuff, I rewatched his videos to see if there would be a clue in there. Luckily it worked out. In [one video](https://youtu.be/Hmmr1oLt-V8?t=28) he blurred the IP inside the terminal, but forgot about the terminal title bar :smile:. I notified him of this, as it was obviously unintended, and the IP was changed shortly after, as many people apparently found it.
|
||||
|
||||
|
||||
{{< figure src="/img/posts/liveoverflow-minecraft-server/first_ip_screenshot.png" title="Screenshot of video containing the IP address" >}}
|
||||
|
||||
### IP change
|
||||
@@ -36,7 +35,7 @@ During my research, I came across masscan. This is a piece of software that lets
|
||||
|
||||
I got to work and wrote a script that scans the IP range in which the old IP was located. It starts by using masscan to scan the entire range of IP addresses, and saves it to a file to use later. I then read this file, and request basic Minecraft server information like its MOTD, players and favicon. This information was saved in another file, in which, I could easily search for LiveOverflow. In the end, the new IP only had one digit changed.
|
||||
|
||||
{{< code language="python" title="scan.py" isCollapsed="true" >}}
|
||||
{{< collapsible-block badge="python" title="scan.py" isCollapsed="true" >}}
|
||||
|
||||
```py
|
||||
import masscan
|
||||
@@ -261,7 +260,7 @@ print(len(current_servers))
|
||||
print(len(valid_servers))
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
_This code is copied from a Jupyter Notebook, so it's not the most efficient and may not even work, the [here for the Github Gist of the Notebook](https://gist.github.com/maikka39/8019e2f1a45e1021fff05bd1e1688e14)_
|
||||
|
||||
@@ -354,7 +353,7 @@ if ((delta > 1f / 256 || deltaAngle > 10f) && !this.player.isImmobile()) {
|
||||
}
|
||||
```
|
||||
|
||||
In short, this code means we can move around a tiny bit before a `PlayerMoveEvent` is sent. This caught my interest, as I thought there might be a way to change the `lastPos`. After reading more code, I found out there was!
|
||||
In short, this code means we can move around a tiny bit before a `PlayerMoveEvent` is sent. This caught my interest, as I thought there might be a way to change the `lastPos`. After reading more code, I found out there was!
|
||||
|
||||
If we send a position that is far away, like x+100, y+100, the player will be teleported back before the `PlayerMoveEvent` gets sent. During this teleport action, `lastPos` get set to the position the player had before the “far away packet” was sent.
|
||||
|
||||
|
||||
@@ -20,22 +20,22 @@ We respect the privacy of our visitors. We collect only such personal informatio
|
||||
|
||||
If you visit our website to browse, read, or download information:
|
||||
|
||||
- Your web browser automatically sends us (and we may retain) information such as the:
|
||||
- Internet domain through which you access the Internet (e.g., yourServiceProvider.com if you use a commercial Internet service provider, or yourSchool.edu if you use an Internet account from your school);
|
||||
- Internet Protocol address of the computer you are using;
|
||||
- type of browser software and operating system you are using;
|
||||
- date and time you access our site; and
|
||||
- the Internet address of the site from which you linked directly to our site.
|
||||
- We will use this information as aggregate data to help us maintain this site, e.g., to determine the number of visitors to different sections of our site, to ensure the site is working properly, and to help us make our site more accessible and useful.
|
||||
- We will not use this information to identify individuals, except for site security or law enforcement purposes.
|
||||
- We will not obtain personally-identifying information about you when you visit our site, unless you choose to provide such information.
|
||||
- Your web browser automatically sends us (and we may retain) information such as the:
|
||||
- Internet domain through which you access the Internet (e.g., yourServiceProvider.com if you use a commercial Internet service provider, or yourSchool.edu if you use an Internet account from your school);
|
||||
- Internet Protocol address of the computer you are using;
|
||||
- type of browser software and operating system you are using;
|
||||
- date and time you access our site; and
|
||||
- the Internet address of the site from which you linked directly to our site.
|
||||
- We will use this information as aggregate data to help us maintain this site, e.g., to determine the number of visitors to different sections of our site, to ensure the site is working properly, and to help us make our site more accessible and useful.
|
||||
- We will not use this information to identify individuals, except for site security or law enforcement purposes.
|
||||
- We will not obtain personally-identifying information about you when you visit our site, unless you choose to provide such information.
|
||||
|
||||
## Other Information We Collect
|
||||
|
||||
If you choose to identify yourself (or otherwise provide us with personal information) when you use our online forms:
|
||||
|
||||
- We will collect (and may retain) any personally identifying information, such as your name, street address, email address, and phone number, and any other information you provide. We will use this information to try to fulfill your request and may use it to provide you with additional information at a later time. We will not disclose such information to third parties, except as specified in this privacy policy.
|
||||
- If you request information, services, or assistance, we may disclose your personal information to those third parties that (in our judgment) are appropriate in order to fulfill your request. If, when you provide us with such information, you specify that you do not want us to disclose the information to third parties, we will honor your request. Note, however, that if you do not provide such information, it may be impossible for us to refer, respond to or fulfill your request.
|
||||
- We will collect (and may retain) any personally identifying information, such as your name, street address, email address, and phone number, and any other information you provide. We will use this information to try to fulfill your request and may use it to provide you with additional information at a later time. We will not disclose such information to third parties, except as specified in this privacy policy.
|
||||
- If you request information, services, or assistance, we may disclose your personal information to those third parties that (in our judgment) are appropriate in order to fulfill your request. If, when you provide us with such information, you specify that you do not want us to disclose the information to third parties, we will honor your request. Note, however, that if you do not provide such information, it may be impossible for us to refer, respond to or fulfill your request.
|
||||
|
||||
## How Long We Keep Information
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1
|
||||
- Points: 1
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 100
|
||||
- Points: 100
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1000
|
||||
- Points: 1000
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1100
|
||||
- Points: 1100
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1200
|
||||
- Points: 1200
|
||||
|
||||
## Description
|
||||
|
||||
@@ -38,13 +38,13 @@ Upon opening the challenge website we're greeted with an input field and a check
|
||||
|
||||
```js
|
||||
function send() {
|
||||
let place = $("#place")[0].value;
|
||||
if (place.length > 0) {
|
||||
$.post("/", { place: place }, function (data) {
|
||||
$("#result")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
return false;
|
||||
let place = $("#place")[0].value;
|
||||
if (place.length > 0) {
|
||||
$.post("/", { place: place }, function (data) {
|
||||
$("#result")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1300
|
||||
- Points: 1300
|
||||
|
||||
## Description
|
||||
|
||||
@@ -117,7 +117,7 @@ Let's try to use the previous attack but with the flag file:
|
||||
|
||||
We get a big error:
|
||||
|
||||
{{< code language="html" title="Error message" >}}
|
||||
{{< collapsible-block badge="html" title="Error message" >}}
|
||||
|
||||
```html
|
||||
<br />
|
||||
@@ -183,7 +183,7 @@ line: 3 in <b>/var/www/html/index.php</b> on line <b>40</b><br />
|
||||
<b>/var/www/html/index.php</b> on line <b>43</b><br />
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
We probably got it because PHP is actually handling the PHP file as a PHP file 😀. This means we have to get it in some other way.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1400
|
||||
- Points: 1400
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1500
|
||||
- Points: 1500
|
||||
|
||||
## Description
|
||||
|
||||
@@ -88,12 +88,12 @@ I came up with the following code:
|
||||
|
||||
```html
|
||||
<script>
|
||||
setTimeout(() => {
|
||||
let flagInput = document.getElementById("flag");
|
||||
flagInput.name = "flag[]";
|
||||
flagInput.value = "hi";
|
||||
flagInput.form.submit();
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
let flagInput = document.getElementById("flag");
|
||||
flagInput.name = "flag[]";
|
||||
flagInput.value = "hi";
|
||||
flagInput.form.submit();
|
||||
}, 1000);
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1600
|
||||
- Points: 1600
|
||||
|
||||
## Description
|
||||
|
||||
@@ -41,12 +41,12 @@ When opening the source of the page we also find the following comment: "Here is
|
||||
|
||||
```js
|
||||
function send() {
|
||||
let emoji = $("#emoji")[0].value;
|
||||
if (emoji.length > 0) {
|
||||
$.post("/", { emoji: emoji }, function (data) {
|
||||
$("#msg")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
let emoji = $("#emoji")[0].value;
|
||||
if (emoji.length > 0) {
|
||||
$.post("/", { emoji: emoji }, function (data) {
|
||||
$("#msg")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -74,7 +74,7 @@ This means the server is most likely using either Jinja2 of Twig.
|
||||
|
||||
Now that we found the vulnerability, we can start exploiting it. Let's start by getting the config. We can try to get it by entering `{{config}}` or `{{config.items()}}` as the emoji.
|
||||
|
||||
{{< code language="python" title="Result" >}}
|
||||
{{< collapsible-block badge="python" title="Result" >}}
|
||||
|
||||
```python
|
||||
dict_items([
|
||||
@@ -224,7 +224,7 @@ dict_items([
|
||||
])
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
If we take a look at it we find an item called 'flag' but it looks like it is encrypted in some way:
|
||||
|
||||
@@ -282,7 +282,7 @@ The source of the server is probably `app.py` as it's the default for flask appl
|
||||
config.__class__.__init__.__globals__['os'].popen('cat app.py').read()
|
||||
```
|
||||
|
||||
{{< code language="python" title="app.py" >}}
|
||||
{{< collapsible-block badge="python" title="app.py" >}}
|
||||
|
||||
```python
|
||||
import random
|
||||
@@ -332,7 +332,7 @@ if __name__ == '__main__':
|
||||
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
When looking at the file, we see that the flag variable is set to the output of the `magic` function:
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1700
|
||||
- Points: 1700
|
||||
|
||||
## Description
|
||||
|
||||
@@ -41,12 +41,12 @@ When opening the source of the page we also find the following comment: "Here is
|
||||
|
||||
```js
|
||||
function send() {
|
||||
let emoji = $("#emoji")[0].value;
|
||||
if (emoji.length > 0) {
|
||||
$.post("/", { emoji: emoji }, function (data) {
|
||||
$("#msg")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
let emoji = $("#emoji")[0].value;
|
||||
if (emoji.length > 0) {
|
||||
$.post("/", { emoji: emoji }, function (data) {
|
||||
$("#msg")[0].innerHTML = "<b>" + data + "</b>";
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -154,7 +154,7 @@ To get the subclasses, we first have to convert `''.__class__.__mro__[1].__subcl
|
||||
|
||||
After submitting this, we get the following result:
|
||||
|
||||
{{< code language="text" title="Result" >}}
|
||||
{{< collapsible-block badge="text" title="Result" >}}
|
||||
|
||||
```js
|
||||
[
|
||||
@@ -643,7 +643,7 @@ After submitting this, we get the following result:
|
||||
]
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
In this result we find the following class: `<class 'os._wrap_close'>`. This is the `os` module and it is on index `127`. We can verify it's index by getting it from the submodules list using the following input:
|
||||
|
||||
@@ -680,7 +680,7 @@ Now let's grab the contents of `app.py`:
|
||||
{{ [[[""|attr("\x5f\x5fclass\x5f\x5f")|attr("\x5f\x5fmro\x5f\x5f")][0][1]|attr("\x5f\x5fsubclasses\x5f\x5f")()][0][127]|attr("\x5f\x5finit\x5f\x5f")|attr("\x5f\x5fglobals\x5f\x5f")][0]["popen"]("cat app\x2epy")|attr("read")() }}
|
||||
```
|
||||
|
||||
{{< code language="python" title="app.py" >}}
|
||||
{{< collapsible-block badge="python" title="app.py" >}}
|
||||
|
||||
```py
|
||||
import random
|
||||
@@ -732,7 +732,7 @@ if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
```
|
||||
|
||||
{{< /code >}}
|
||||
{{< /collapsible-block >}}
|
||||
|
||||
## Magic function
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ aliases = [
|
||||
]
|
||||
+++
|
||||
|
||||
- Points: 1800
|
||||
- Points: 1800
|
||||
|
||||
## Description
|
||||
|
||||
@@ -41,22 +41,22 @@ When opening the source of the page we also find some javascript code:
|
||||
|
||||
```js
|
||||
function send() {
|
||||
let calc = $("#calc")[0].value;
|
||||
if (calc.length > 0) {
|
||||
$.ajax({
|
||||
url: "/calc",
|
||||
type: "POST",
|
||||
data: '{"calc": "' + calc + '" }',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
}).always(function (data) {
|
||||
text = data;
|
||||
if (data.responseText) {
|
||||
text = data.responseText;
|
||||
}
|
||||
$("#msg")[0].innerHTML = "<b>" + text + "</b>";
|
||||
});
|
||||
}
|
||||
let calc = $("#calc")[0].value;
|
||||
if (calc.length > 0) {
|
||||
$.ajax({
|
||||
url: "/calc",
|
||||
type: "POST",
|
||||
data: '{"calc": "' + calc + '" }',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
}).always(function (data) {
|
||||
text = data;
|
||||
if (data.responseText) {
|
||||
text = data.responseText;
|
||||
}
|
||||
$("#msg")[0].innerHTML = "<b>" + text + "</b>";
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -68,7 +68,7 @@ If we capture the request with a proxy like Burp, we can see it sends a `POST` r
|
||||
|
||||
```json
|
||||
{
|
||||
"calc": "3+4"
|
||||
"calc": "3+4"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -96,7 +96,7 @@ A NodeJS Express server often has a `res` variable to which the request result i
|
||||
|
||||
```json
|
||||
{
|
||||
"calc": "res"
|
||||
"calc": "res"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -112,7 +112,7 @@ The resulting request:
|
||||
|
||||
```json
|
||||
{
|
||||
"calc": "require('fs').readdirSync('.')"
|
||||
"calc": "require('fs').readdirSync('.')"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -126,7 +126,7 @@ Now that we know the location of the flag (`flag.txt`), we can use the `readFile
|
||||
|
||||
```json
|
||||
{
|
||||
"calc": "require('fs').readFileSync('flag.txt')"
|
||||
"calc": "require('fs').readFileSync('flag.txt')"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||