Skip to content

Commit 549ce65

Browse files
committed
impr
1 parent fc39298 commit 549ce65

File tree

114 files changed

+1193
-672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1193
-672
lines changed

src/SUMMARY.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,10 @@
284284
- [Places to steal NTLM creds](windows-hardening/ntlm/places-to-steal-ntlm-creds.md)
285285
- [Lateral Movement](windows-hardening/lateral-movement/README.md)
286286
- [AtExec / SchtasksExec](windows-hardening/lateral-movement/atexec.md)
287-
- [DCOM Exec](windows-hardening/lateral-movement/dcom-exec.md)
287+
- [DCOM Exec](windows-hardening/lateral-movement/dcomexec.md)
288288
- [PsExec/Winexec/ScExec](windows-hardening/lateral-movement/psexec-and-winexec.md)
289+
- [RDPexec](windows-hardening/lateral-movement/rdpexec.md)
290+
- [SCMexec](windows-hardening/lateral-movement/scmexec.md)
289291
- [SmbExec/ScExec](windows-hardening/lateral-movement/smbexec.md)
290292
- [WinRM](windows-hardening/lateral-movement/winrm.md)
291293
- [WmiExec](windows-hardening/lateral-movement/wmiexec.md)
@@ -299,6 +301,7 @@
299301
- [PowerView/SharpView](windows-hardening/basic-powershell-for-pentesters/powerview.md)
300302
- [Antivirus (AV) Bypass](windows-hardening/av-bypass.md)
301303
- [Cobalt Strike](windows-hardening/cobalt-strike.md)
304+
- [Mythic](windows-hardening/mythic.md)
302305

303306
# 📱 Mobile Pentesting
304307

src/backdoors/salseo.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Compile those projects for the architecture of the windows box where your are go
1010

1111
You can **select the architecture** inside Visual Studio in the **left "Build" Tab** in **"Platform Target".**
1212

13-
(\*\*If you can't find this options press in **"Project Tab"** and then in **"\<Project Name> Properties"**)
13+
(**If you can't find this options press in **"Project Tab"** and then in **"\<Project Name> Properties"**)
1414

1515
![](<../images/image (132).png>)
1616

src/binary-exploitation/rop-return-oriented-programing/ret2lib/rop-leaking-libc-address/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Let's explain this final ROP.\
245245
The last ROP (`rop1`) ended calling again the main function, then we can **exploit again** the **overflow** (that's why the `OFFSET` is here again). Then, we want to call `POP_RDI` pointing to the **addres** of _"/bin/sh"_ (`BINSH`) and call **system** function (`SYSTEM`) because the address of _"/bin/sh"_ will be passed as a parameter.\
246246
Finally, the **address of exit function** is **called** so the process **exists nicely** and any alert is generated.
247247
248-
**This way the exploit will execute a \_/bin/sh**\_\*\* shell.\*\*
248+
**This way the exploit will execute a _/bin/sh_ shell.**
249249
250250
![](<../../../../images/image (165).png>)
251251

src/binary-exploitation/stack-overflow/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void vulnerable() {
2727

2828
The most common way to find stack overflows is to give a very big input of `A`s (e.g. `python3 -c 'print("A"*1000)'`) and expect a `Segmentation Fault` indicating that the **address `0x41414141` was tried to be accessed**.
2929

30-
Moreover, once you found that there is Stack Overflow vulnerability you will need to find the offset until it's possible to **overwrite the return address**, for this it's usually used a **De Bruijn sequence.** Which for a given alphabet of size _k_ and subsequences of length _n_ is a **cyclic sequence in which every possible subsequence of length \_n**\_\*\* appears exactly once\*\* as a contiguous subsequence.
30+
Moreover, once you found that there is Stack Overflow vulnerability you will need to find the offset until it's possible to **overwrite the return address**, for this it's usually used a **De Bruijn sequence.** Which for a given alphabet of size _k_ and subsequences of length _n_ is a **cyclic sequence in which every possible subsequence of length _n_ appears exactly once** as a contiguous subsequence.
3131

3232
This way, instead of needing to figure out which offset is needed to control the EIP by hand, it's possible to use as padding one of these sequences and then find the offset of the bytes that ended overwriting it.
3333

src/crypto-and-stego/crypto-ctfs-tricks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ krodfdudfrod
212212

213213
**Multitap** [replaces a letter](https://www.dcode.fr/word-letter-change) by repeated digits defined by the corresponding key code on a mobile [phone keypad](https://www.dcode.fr/phone-keypad-cipher) (This mode is used when writing SMS).\
214214
For example: 2=A, 22=B, 222=C, 3=D...\
215-
You can identify this code because you will see\*\* several numbers repeated\*\*.
215+
You can identify this code because you will see** several numbers repeated**.
216216

217217
You can decode this code in: [https://www.dcode.fr/multitap-abc-cipher](https://www.dcode.fr/multitap-abc-cipher)
218218

src/cryptography/crypto-ctfs-tricks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ krodfdudfrod
212212

213213
**Multitap** [replaces a letter](https://www.dcode.fr/word-letter-change) by repeated digits defined by the corresponding key code on a mobile [phone keypad](https://www.dcode.fr/phone-keypad-cipher) (This mode is used when writing SMS).\
214214
For example: 2=A, 22=B, 222=C, 3=D...\
215-
You can identify this code because you will see\*\* several numbers repeated\*\*.
215+
You can identify this code because you will see** several numbers repeated**.
216216

217217
You can decode this code in: [https://www.dcode.fr/multitap-abc-cipher](https://www.dcode.fr/multitap-abc-cipher)
218218

src/forensics/basic-forensic-methodology/anti-forensic-techniques.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Timestamps
55

66
An attacker may be interested in **changing the timestamps of files** to avoid being detected.\
7-
It's possible to find the timestamps inside the MFT in attributes `$STANDARD_INFORMATION` ** and ** `$FILE_NAME`.
7+
It's possible to find the timestamps inside the MFT in attributes `$STANDARD_INFORMATION`**and**`$FILE_NAME`.
88

99
Both attributes have 4 timestamps: **Modification**, **access**, **creation**, and **MFT registry modification** (MACE or MACB).
1010

src/generic-hacking/exfiltration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ Then copy-paste the text into the windows-shell and a file called nc.exe will be
362362

363363
## DNS
364364

365-
- [https://github.com/62726164/dns-exfil](https://github.com/62726164/dns-exfil)
365+
- [https://github.com/Stratiz/DNS-Exfil](https://github.com/Stratiz/DNS-Exfil)
366366

367367
{{#include ../banners/hacktricks-training.md}}
368368

src/generic-hacking/tunneling-and-port-forwarding.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ To note:
193193
> [!WARNING]
194194
> In this case, the **port is opened in the beacon host**, not in the Team Server and the **traffic is sent to the Cobalt Strike client** (not to the Team Server) and from there to the indicated host:port
195195
196-
```
196+
```bash
197197
rportfwd_local [bind port] [forward host] [forward port]
198198
rportfwd_local stop [bind port]
199199
```

src/generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Inveigh is a tool for penetration testers and red teamers, designed for Windows
5454

5555
Inveigh can be operated through PowerShell:
5656

57-
```powershell
57+
```bash
5858
Invoke-Inveigh -NBNS Y -ConsoleOutput Y -FileOutput Y
5959
```
6060

src/linux-hardening/privilege-escalation/docker-security/abusing-docker-socket-for-privilege-escalation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You could also **abuse a mount to escalate privileges** inside the container.
2020
- `--userns=host`
2121
- `--uts=host`
2222
- `--cgroupns=host`
23-
- \*\*`--device=/dev/sda1 --cap-add=SYS_ADMIN --security-opt apparmor=unconfined` \*\* -> This is similar to the previous method, but here we are **mounting the device disk**. Then, inside the container run `mount /dev/sda1 /mnt` and you can **access** the **host filesystem** in `/mnt`
23+
- **`--device=/dev/sda1 --cap-add=SYS_ADMIN --security-opt apparmor=unconfined`** -> This is similar to the previous method, but here we are **mounting the device disk**. Then, inside the container run `mount /dev/sda1 /mnt` and you can **access** the **host filesystem** in `/mnt`
2424
- Run `fdisk -l` in the host to find the `</dev/sda1>` device to mount
2525
- **`-v /tmp:/host`** -> If for some reason you can **just mount some directory** from the host and you have access inside the host. Mount it and create a **`/bin/bash`** with **suid** in the mounted directory so you can **execute it from the host and escalate to root**.
2626

src/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Coming at some point of 2023...
2525

2626
#### openssl
2727

28-
\***\*[**In this post,**](https://www.form3.tech/engineering/content/exploiting-distroless-images) it is explained that the binary **`openssl`** is frequently found in these containers, potentially because it's **needed\*\* by the software that is going to be running inside the container.
28+
\***\*[**In this post,**](https://www.form3.tech/engineering/content/exploiting-distroless-images) it is explained that the binary **`openssl`** is frequently found in these containers, potentially because it's **needed** by the software that is going to be running inside the container.
2929

3030
{{#include ../../../banners/hacktricks-training.md}}
3131

src/linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ cat /dev/fb0 > /tmp/screen.raw
199199
cat /sys/class/graphics/fb0/virtual_size
200200
```
201201

202-
To **open** the **raw image** you can use **GIMP**, select the \*\*`screen.raw` \*\* file and select as file type **Raw image data**:
202+
To **open** the **raw image** you can use **GIMP**, select the **`screen.raw`** file and select as file type **Raw image data**:
203203

204204
![](<../../../images/image (463).png>)
205205

src/linux-hardening/privilege-escalation/linux-active-directory.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ This procedure will attempt to inject into various sessions, indicating success
7070

7171
SSSD maintains a copy of the database at the path `/var/lib/sss/secrets/secrets.ldb`. The corresponding key is stored as a hidden file at the path `/var/lib/sss/secrets/.secrets.mkey`. By default, the key is only readable if you have **root** permissions.
7272

73-
Invoking \*\*`SSSDKCMExtractor` \*\* with the --database and --key parameters will parse the database and **decrypt the secrets**.
73+
Invoking **`SSSDKCMExtractor`** with the --database and --key parameters will parse the database and **decrypt the secrets**.
7474

7575
```bash
7676
git clone https://github.com/fireeye/SSSDKCMExtractor

src/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ ARM64 instructions generally have the **format `opcode dst, src1, src2`**, where
143143
- **`lsl`**, **`lsr`**, **`asr`**, **`ror`, `rrx`**:
144144
- **Logical shift left**: Add 0s from the end moving the other bits forward (multiply by n-times 2)
145145
- **Logical shift right**: Add 1s at the beginning moving the other bits backward (divide by n-times 2 in unsigned)
146-
- **Arithmetic shift right**: Like **`lsr`**, but instead of adding 0s if the most significant bit is a 1, \*\*1s are added (\*\*divide by ntimes 2 in signed)
146+
- **Arithmetic shift right**: Like **`lsr`**, but instead of adding 0s if the most significant bit is a 1, **1s are added (**divide by ntimes 2 in signed)
147147
- **Rotate right**: Like **`lsr`** but whatever is removed from the right it's appended to the left
148148
- **Rotate Right with Extend**: Like **`ror`**, but with the carry flag as the "most significant bit". So the carry flag is moved to the bit 31 and the removed bit to the carry flag.
149149
- **`bfm`**: **Bit Filed Move**, these operations **copy bits `0...n`** from a value an place them in positions **`m..m+n`**. The **`#s`** specifies the **leftmost bit** position and **`#r`** the **rotate right amount**.
@@ -250,7 +250,7 @@ ldp x29, x30, [sp], #16 ; load pair x29 and x30 from the stack and increment th
250250

251251
Armv8-A support the execution of 32-bit programs. **AArch32** can run in one of **two instruction sets**: **`A32`** and **`T32`** and can switch between them via **`interworking`**.\
252252
**Privileged** 64-bit programs can schedule the **execution of 32-bit** programs by executing a exception level transfer to the lower privileged 32-bit.\
253-
Note that the transition from 64-bit to 32-bit occurs with a lower of the exception level (for example a 64-bit program in EL1 triggering a program in EL0). This is done by setting the **bit 4 of** **`SPSR_ELx`** special register **to 1** when the `AArch32` process thread is ready to be executed and the rest of `SPSR_ELx` stores the **`AArch32`** programs CPSR. Then, the privileged process calls the **`ERET`** instruction so the processor transitions to **`AArch32`** entering in A32 or T32 depending on CPSR\*\*.\*\*
253+
Note that the transition from 64-bit to 32-bit occurs with a lower of the exception level (for example a 64-bit program in EL1 triggering a program in EL0). This is done by setting the **bit 4 of** **`SPSR_ELx`** special register **to 1** when the `AArch32` process thread is ready to be executed and the rest of `SPSR_ELx` stores the **`AArch32`** programs CPSR. Then, the privileged process calls the **`ERET`** instruction so the processor transitions to **`AArch32`** entering in A32 or T32 depending on CPSR**.**
254254

255255
The **`interworking`** occurs using the J and T bits of CPSR. `J=0` and `T=0` means **`A32`** and `J=0` and `T=1` means **T32**. This basically traduces on setting the **lowest bit to 1** to indicate the instruction set is T32.\
256256
This is set during the **interworking branch instructions,** but can also be set directly with other instructions when the PC is set as the destination register. Example:

src/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-electron-applications-injection.md

+8
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ Therefore, if you want to abuse entitlements to access the camera or microphone
431431

432432
## Automatic Injection
433433

434+
- [**electroniz3r**](https://github.com/r3ggi/electroniz3r)
435+
434436
The tool [**electroniz3r**](https://github.com/r3ggi/electroniz3r) can be easily used to **find vulnerable electron applications** installed and inject code on them. This tool will try to use the **`--inspect`** technique:
435437

436438
You need to compile it yourself and can use it like this:
@@ -471,6 +473,12 @@ The webSocketDebuggerUrl is: ws://127.0.0.1:13337/8e0410f0-00e8-4e0e-92e4-58984d
471473
Shell binding requested. Check `nc 127.0.0.1 12345`
472474
```
473475

476+
477+
- [https://github.com/boku7/Loki](https://github.com/boku7/Loki)
478+
479+
Loki was designed to backdoor Electron applications by replacing the applications JavaScript files with the Loki Command & Control JavaScript files.
480+
481+
474482
## References
475483

476484
- [https://www.electronjs.org/docs/latest/tutorial/fuses](https://www.electronjs.org/docs/latest/tutorial/fuses)

src/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/macos-ipc-inter-process-communication/macos-mig-mach-interface-generator.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ In this example we have only defined 1 function in the definitions, but if we wo
118118

119119
If the function was expected to send a **reply** the function `mig_internal kern_return_t __MIG_check__Reply__<name>` would also exist.
120120

121-
Actually it's possible to identify this relation in the struct **`subsystem_to_name_map_myipc`** from **`myipcServer.h`** (**`subsystem*to_name_map*\***`\*\* in other files):
121+
Actually it's possible to identify this relation in the struct **`subsystem_to_name_map_myipc`** from **`myipcServer.h`** (**`subsystem*to_name_map*\***`** in other files):
122122

123123
```c
124124
#ifndef subsystem_to_name_map_myipc

src/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-tcc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ If you have **`kTCCServiceEndpointSecurityClient`**, you have FDA. End.
536536
537537
### User TCC DB to FDA
538538
539-
Obtaining **write permissions** over the **user TCC** database you \*\*can'\*\*t grant yourself **`FDA`** permissions, only the one that lives in the system database can grant that.
539+
Obtaining **write permissions** over the **user TCC** database you **can'**t grant yourself **`FDA`** permissions, only the one that lives in the system database can grant that.
540540
541541
But you can **can** give yourself **`Automation rights to Finder`**, and abuse the previous technique to escalate to FDA\*.
542542

src/mobile-pentesting/android-app-pentesting/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Pay special attention to **firebase URLs** and check if it is bad configured. [M
6464

6565
### Basic understanding of the application - Manifest.xml, strings.xml
6666

67-
The **examination of an application's \_Manifest.xml**_\*\* and \*\*_**strings.xml**\_\*\* files can reveal potential security vulnerabilities\*\*. These files can be accessed using decompilers or by renaming the APK file extension to .zip and then unzipping it.
67+
The **examination of an application's _Manifest.xml_ and **_strings.xml_** files can reveal potential security vulnerabilities**. These files can be accessed using decompilers or by renaming the APK file extension to .zip and then unzipping it.
6868

6969
**Vulnerabilities** identified from the **Manifest.xml** include:
7070

src/mobile-pentesting/android-app-pentesting/drozer-tutorial/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ A exported service is declared inside the Manifest.xml:
164164
<service android:name=".AuthService" android:exported="true" android:process=":remote"/>
165165
```
166166

167-
Inside the code **check** for the \*\*`handleMessage`\*\*function which will **receive** the **message**:
167+
Inside the code **check** for the **`handleMessage`**function which will **receive** the **message**:
168168

169169
![](<../../../images/image (82).png>)
170170

src/network-services-pentesting/5984-pentesting-couchdb.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ These are the endpoints where you can access with a **GET** request and extract
4646

4747
- **`/_active_tasks`** List of running tasks, including the task type, name, status and process ID.
4848
- **`/_all_dbs`** Returns a list of all the databases in the CouchDB instance.
49-
- \*\*`/_cluster_setup`\*\*Returns the status of the node or cluster, per the cluster setup wizard.
49+
- **`/_cluster_setup`**Returns the status of the node or cluster, per the cluster setup wizard.
5050
- **`/_db_updates`** Returns a list of all database events in the CouchDB instance. The existence of the `_global_changes` database is required to use this endpoint.
5151
- **`/_membership`** Displays the nodes that are part of the cluster as `cluster_nodes`. The field `all_nodes` displays all nodes this node knows about, including the ones that are part of the cluster.
5252
- **`/_scheduler/jobs`** List of replication jobs. Each job description will include source and target information, replication id, a history of recent event, and a few other things.
@@ -58,8 +58,8 @@ These are the endpoints where you can access with a **GET** request and extract
5858
- **`/_node/{node-name}/_system`** The \_systemresource returns a JSON object containing various system-level statistics for the running server\_.\_ You can use \_\_`_local` as {node-name} to get current node info.
5959
- **`/_node/{node-name}/_restart`**
6060
- **`/_up`** Confirms that the server is up, running, and ready to respond to requests. If [`maintenance_mode`](https://docs.couchdb.org/en/latest/config/couchdb.html#couchdb/maintenance_mode) is `true` or `nolb`, the endpoint will return a 404 response.
61-
- \*\*`/_uuids`\*\*Requests one or more Universally Unique Identifiers (UUIDs) from the CouchDB instance.
62-
- \*\*`/_reshard`\*\*Returns a count of completed, failed, running, stopped, and total jobs along with the state of resharding on the cluster.
61+
- **`/_uuids`**Requests one or more Universally Unique Identifiers (UUIDs) from the CouchDB instance.
62+
- **`/_reshard`**Returns a count of completed, failed, running, stopped, and total jobs along with the state of resharding on the cluster.
6363

6464
More interesting information can be extracted as explained here: [https://lzone.de/cheat-sheet/CouchDB](https://lzone.de/cheat-sheet/CouchDB)
6565

0 commit comments

Comments
 (0)