Skip to content

Commit 74f169f

Browse files
committed
f
1 parent 6cd4c54 commit 74f169f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/network-services-pentesting/pentesting-web/special-http-headers.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,53 @@ Lastly, HSTS is a security feature that forces browsers to communicate with serv
215215
Strict-Transport-Security: max-age=3153600
216216
```
217217

218+
### **Permissions-Policy (formerly Feature-Policy)**
219+
220+
Permissions-Policy allows web developers to selectively enable, disable, or modify the behaviour of certain browser features and APIs within a document. It is the successor to the now-deprecated `Feature-Policy` header. This header helps reduce the attack surface by restricting access to powerful features that could be abused.
221+
222+
```
223+
Permissions-Policy: geolocation=(), camera=(), microphone=()
224+
```
225+
226+
**Common directives:**
227+
228+
| Directive | Description |
229+
| --- | --- |
230+
| `accelerometer` | Controls access to the Accelerometer sensor |
231+
| `camera` | Controls access to video input devices (webcam) |
232+
| `geolocation` | Controls access to the Geolocation API |
233+
| `gyroscope` | Controls access to the Gyroscope sensor |
234+
| `magnetometer` | Controls access to the Magnetometer sensor |
235+
| `microphone` | Controls access to audio input devices |
236+
| `payment` | Controls access to the Payment Request API |
237+
| `usb` | Controls access to the WebUSB API |
238+
| `fullscreen` | Controls access to the Fullscreen API |
239+
| `autoplay` | Controls whether media can autoplay |
240+
| `clipboard-read` | Controls access to read clipboard content |
241+
| `clipboard-write` | Controls access to write to the clipboard |
242+
243+
**Syntax values:**
244+
245+
- `()` - Disables the feature entirely
246+
- `(self)` - Allows the feature only for the same origin
247+
- `*` - Allows the feature for all origins
248+
- `(self "https://example.com")` - Allows for same origin and specified domain
249+
250+
**Example configurations:**
251+
252+
```
253+
# Restrictive policy - disable most features
254+
Permissions-Policy: geolocation=(), camera=(), microphone=(), payment=(), usb=()
255+
256+
# Allow camera only from same origin
257+
Permissions-Policy: camera=(self)
258+
259+
# Allow geolocation for same origin and a trusted partner
260+
Permissions-Policy: geolocation=(self "https://maps.example.com")
261+
```
262+
263+
From a security perspective, missing or overly permissive `Permissions-Policy` headers may allow attackers (e.g., through XSS or embedded iframes) to abuse powerful browser features. Always restrict features to the minimum necessary for your application.
264+
218265
## Header Name Casing Bypass
219266

220267
HTTP/1.1 defines header field‐names as **case-insensitive** (RFC 9110 §5.1). Nevertheless, it is very common to find custom middleware, security filters, or business logic that compare the *literal* header name received without normalising the casing first (e.g. `header.equals("CamelExecCommandExecutable")`). If those checks are performed **case-sensitively**, an attacker may bypass them simply by sending the same header with a different capitalisation.

0 commit comments

Comments
 (0)