You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/web-application-security/10-end-to-end/reading/index.md
+31-29Lines changed: 31 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@ linkTitle: 10. End-to-End Attack
3
3
type: docs
4
4
weight: 10
5
5
---
6
+
# End to End Attacks
7
+
6
8
## Introduction
7
9
8
10
There are multiple stages of a cyber attack: many of them contains five common stages used by a hacker to break into a system and also control it.
@@ -71,29 +73,30 @@ The attacker would change their MAC address and run the attacking machine throug
71
73
## How to find targets in the wild
72
74
73
75
### Find targets using shodan.io
76
+
74
77
As presented to you in another session, **[shodan.io](https://www.shodan.io/dashboard)** is a powerful search engine that can help you to find vulnerable targets on the internet, using different search queries.
75
78
A search query can contain, for example, the name of the product like a simple ```weblogic``` which represents the name of the WebLogic server developed by Oracle.
But we can also use more specific queries to find targets that interest us. You can also specify the port numbers inside the shodan query, using the ```port:``` filter.
80
83
Knowing that [WSO2](https://wso2.com) the default HTTP and HTTPS ports of a WSO2 product are 9763 and 9443 respectively, we can try to use the ```WSO2 port:9443,9763``` query, you can find some [WSO2](https://wso2.com) targets across the internet.
You can find the favicon hash of an website, using the [FaviconHash website](https://faviconhash.com). For example, let's find out the favicon hash of the github.com website.
As you can see, we now have more than 700 results of potential vulnerable applications.
99
102
Note that in order to use Shodan filters (http.favicon.hash) you must be logged in.
@@ -104,15 +107,15 @@ Google Dorks involves using advanced operators in the Google search engine to lo
104
107
Common cases of using Google Dorks are finding specific versions of vulnerable Web applications.
105
108
Taking the previous example, we want to find some vulnerable versions of the WSO2 product after the release of the [CVE-2022-29464](https://www.trendmicro.com/en_us/research/22/e/patch-your-wso2-cve-2022-29464-exploited-to-install-linux-compatible-cobalt-strike-beacons-other-malware.html) so we will use Google Dorks, knowing the vulnerable endpoints of the vulnerable product.
### Use automation to find vulnerable targets with Nuclei
118
121
@@ -128,9 +131,9 @@ Taking the same previous CVE-2022-29464 as an example, we can use our shodan.io
128
131
129
132
First we need to download the results of the [shodan search used for the WSO2 targets](https://www.shodan.io/search?query=WSO2+port%3A9443%2C9763): just press the Download Results button and wait for the ```.json.gz``` file to be downloaded then unzip it using ```gzip -d <finding>.json.gz```
Our main interests of the ```<finding>.json.gz``` are the IP:PORT fields of every resulted information of the target; so the first approach is to extract these two fields, using [jq](https://stedolan.github.io/jq/) Linux utility - a sed for JSON data.
136
139
@@ -144,7 +147,7 @@ Another approach is to use the shodan [API](https://help.shodan.io/guides/how-to
144
147
145
148
You can use the following commands to download the data:
@@ -164,7 +167,7 @@ After the installation is completed, as we said, we will choose to scan targets
164
167
165
168
We can see that our target was found vulnerable by nuclei.
166
169
167
-
<imgsrc="../media/nuclei_run.png">
170
+

168
171
169
172
## CVEs exploitation
170
173
@@ -200,13 +203,13 @@ So, the main idea is to send a **POST** request containing a web shell, which le
200
203
201
204
First, turn on the Intercept and catch a request to the ```/carbon``` endpoint, using the Chromium browser. Access the ```https://<IP>:9443/carbon``` from the Chromium Browser.
Now, send the caught request to Repeater, using the **Ctrl+R** keyboard shortcut; this allows us to modify the request, trying to replicate the request that will succeed to our exploitation.
As we said before, we can upload any file on the WSO2 server -- we want a file that can interpret commands: we will try to upload a web shell jsp file with the following content:
212
215
@@ -241,12 +244,12 @@ if (request.getParameter("cmd") != null) {
241
244
Let's modify the request and send a new request containing the web shell file having the name ```sss.jsp```.
242
245
This file will be uploaded at the ```/authenticationendpoint/sss.jsp``` endpoint.
To check if the server is vulnerable and the command was successfully executed, we would like the target server to communicate with our created logger: we will make the target to send a GET request to our REQUEST-BIN-URL.
284
287
We will introduce a curl command inside the backticks that we discussed before.
285
288
286
289
But first, we will encode it with base64 inside the URL and then execute it using bash command.
We can spot two GET requests as we have talked before: one request sent by our shell because of the backticks and another one interpreted by the target shell, meaning that the target is vulnerable.
But we will to extract some system information from the target, so we will try to execute a command and send it with curl. The ```-d``` parameter of curl will specify that we send a request with some data in it: that will be the output of the ```whoami``` command.
@@ -327,11 +329,11 @@ The affected versions of Apache were Apache 2.4.49 & 2.4.50.
327
329
Path normalization mechanism of Apache HTTP Server 2.4.49, it does not properly neutralize sequences such as ".." so this will result in accessing files outside the current directory.
328
330
Using the ```%2e``` (which is the URL encoding of '.') inside the target URL, we can successfully run a path traversal attack:
0 commit comments