Laravel

Laravel Pentesting / Exploits

ko-fi

Detection

Version

Sometimes the version is printed

Enumeration

SSTI

SSTI

CVE

Also check deserialization attacks part

CVE-2021-3129 (Remote Code Execution)

  1. Laravel 4.8.28 ~ 5.x - PHPUnit Remote Code Execution (CVE-2017-9841)

PoC:

Exposed environment variable

Vulnerable path:

RCE

Exposed log files

Debug mode

  • Try to request to https://example.com using POST method (Error 405)

  • Using [] in paramater (ex:example.com/param[]=0)

If Laravel is in debugging mode you will be able to access the code and sensitive data. For example http://127.0.0.1:8000/profiles

Laravel FileManager

.env

Laravel saves the APP it uses to encrypt the cookies and other credentials inside a file called .env that can be accessed using some path traversal under: /../.env

Laravel will also show this information inside the debug page (that appears when Laravel finds an error and it's activated).

Using the secret APP_KEY of Laravel you can decrypt and re-encrypt cookies:

Laravel crypto killer - Deserialization attacks

By default, a call to the decrypt function will consider the decrypted string as serialized data.

The variable used as the decryption key in the openssl_decrypt function is the APP_KEY. In summary, a user in possession of this secret will be able to re-encrypt data to carry out a deserialization attack and thus compromise the server hosting the Laravel application.

CVE-2024-55555 - Invoice Ninja

Generate a serialization payload:

Exploit:

CVE-2024-48987 - Snipe IT - XSRF-TOKEN serialization

Retrieve the cookie DqNfdAQoevsVc3L2TmqIttblIQGIJPVdLrwoY7xT:

Decrypt the cookie:

Encrypt the serialized payload - The hash value before the pipe (|) (here ae8213eefa7b10062a52485c7dcca8a5a937cc1c) should then be passed to the --session_cookie option to re-encrypt a valid Laravel cookie.

Checks 'laravel_session' cookies for known laravel 'APP_KEY'

BadSecrets:

APP_KEY - Bruteforce

By default, each cookie set by Laravel is a value encrypted via the encrypt function. Therefore, these values can be used to brute force the associated APP_KEY.

Bruteforce:

APP_KEY top 10

Position
Number of public servers sharing it
APP_KEY
Description

🥇

561

W8UqtE9LHZW+gRag78o4BCbN1M0w4HdaIFdLqHJ/9PA=

Default key of UltimatePOS available on CodeCanyon

🥈

491

SbzM2tzPsCSlpTEdyaju8l9w2C5vmtd4fNAduiLEqng=

Frequently used in bootstrapped projects

🥉

415

otfhCHVghYrivHkzWqQnhnLmz0bZO72lKX7TxfD6msI=

Default key of XPanel SSH User Management

4️⃣

313

U29tZVJhbmRvbVN0cmluZ09mMzJDaGFyc0V4YWN0bHk=

base64 value of SomeRandomStringOf32 CharsExactly

5️⃣

257

FBhoCqWGOmuNcUh/3E5cnwB3zNCF4rZ7G19WRW4KVOs=

APP_KEY shared between unrelated projects

6️⃣

216

U29tZVJhbmRvbVN0cmluZw==

Default APP_KEY on older Laravel Version base64 value of SomeRandomString

7️⃣

198

1HJ+CWiouSuJODKAgrMxvwxcm2Tg8MjlrqSl/8ViT5E=

Seems linked to several platforms linked to crypto wallet management

8️⃣

195

EmFb+cmLbacowY1N9P8Y8+PAcRXU7SDU2rxBL1oaVyw=

Default key of WASender a message sender for WhatsApp

9️⃣

177

yPBSs/6cUPg+mwXV00hWJpB8TFk4LT+YduzProk5//Q=

Default key on several AI based projects

🔟

155

ahimIiG674yV4DkPWx6f7t9dkMmTFK2S+0lCPglpVfs=

Key shared between several random Laravel projects, seems they are copying each other

11

152

RR++yx2rJ9kdxbdh3+AmbHLDQu+Q76i++co9Y8ybbno=

Default key on Invoice ninja

79

44

3ilviXqB9u6DX1NRcyWGJ+sjySF+H18CPDGb3+IVwMQ=

Default key on Snipe-IT

Position
Number of public servers sharing it
APP_KEY
Description
Position since 2024

🥇

1650

W8UqtE9LHZW+gRag78o4BCbN1M0w4HdaIFdLqHJ/9PA=

Default key of UltimatePOS available on CodeCanyon

🟰

🥈

1132

xf8woJXKNEFH1rjGffK/GBw2KxjMsxkleON68YnWdaw=

Key shared between several projects of an Indonesian company

🆕

🥉

518

U29tZVJhbmRvbVN0cmluZ09mMzJDaGFyc0V4YWN0bHk==

base64 value of SomeRandomStringOf32CharsExactly

⬆️

4️⃣

275

SbzM2tzPsCSlpTEdyaju8l9w2C5vmtd4fNAduiLEqng=

Frequently used in bootstrapped projects

⬇️

5️⃣

275

otfhCHVghYrivHkzWqQnhnLmz0bZO72lKX7TxfD6msI=

Default key of XPanel SSH User Management

⬇️

6️⃣

203

U29tZVJhbmRvbVN0cmluZw==

Default APP_KEY on older Laravel Version base64 value of SomeRandomString

🟰

7️⃣

170

FBhoCqWGOmuNcUh/3E5cnwB3zNCF4rZ7G19WRW4KVOs=

APP_KEY shared between unrelated projects

⬇️

8️⃣

165

BlQYTmcfZGV4XShvK5Z+ffNVWv0qszkUTRuEGmQ76lw=

Default key of Rocket LMS available on CodeCanyon

🆕

9️⃣

164

EmFb+cmLbacowY1N9P8Y8+PAcRXU7SDU2rxBL1oaVyw=

Default key of WASender a message sender for WhatsApp

⬇️

🔟

157

hMS5VtciEk3t/0Ije8BCRl+AZOvU2gJanbAw5i/LgIs=

Default key of Flex Home - Laravel Real Estate Multilingual System available on CodeCanyon

🆕

11

153

3ilviXqB9u6DX1NRcyWGJ+sjySF+H18CPDGb3+IVwMQ=

Default key on Snipe-IT

⬆️

19

94

ahimIiG674yV4DkPWx6f7t9dkMmTFK2S+0lCPglpVfs=

Key shared between several random Laravel projects, seems they are copying each other

⬇️

24

87

yPBSs/6cUPg+mwXV00hWJpB8TFk4LT+YduzProk5//Q=

Default key on several AI based projects

⬇️

26

84

RR++yx2rJ9kdxbdh3+AmbHLDQu+Q76i++co9Y8ybbno=

Default key on Invoice ninja

⬇️

320

11

1HJ+CWiouSuJODKAgrMxvwxcm2Tg8MjlrqSl/8ViT5E=

Seems linked to several platforms linked to crypto wallet management

⬇️

Scanners

Other exploits

Resources

Interesting Books

Interesting Books

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

Support this Gitbook

I hope it helps you as much as it has helped me. If you can support me in any way, I would deeply appreciate it.

ko-fi

buymeacoffee

Last updated