nextcloud / nextcloud/calendar
Mobile Chrome event update sends duplicate charset in Content-Type, triggering ModSecurity CRS 920530
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 332
- Avg merge
- 16h 13m
- Merged PRs (30d)
- 137
Description
Description
When saving an event from the Calendar web UI, the client sends a CalDAV PUT request for the event .ics resource with a duplicated charset parameter in the Content-Type header.
Observed sanitized request shape:
PUT /remote.php/dav/calendars/<user>/<calendar>/<uid>.ics
Content-Type: text/calendar; charset=UTF-8; component=vevent; charset=UTF-8
Because charset=UTF-8 appears twice, OWASP CRS / ModSecurity rule 920530 detects this as:
Multiple charsets detected in content type header
The WAF interrupts the request, so the event update fails. In the captured transaction the response status was 404 and transaction.is_interrupted was true.
Expected behavior
Calendar should send a valid Content-Type header with only one charset parameter, for example:
Content-Type: text/calendar; charset=UTF-8; component=vevent
or otherwise avoid duplicating charset when adding the VEVENT component parameter.
Actual behavior
Calendar sends:
Content-Type: text/calendar; charset=UTF-8; component=vevent; charset=UTF-8
This triggers OWASP CRS / ModSecurity rule 920530, causing the request to be blocked/interrupted.
Steps to reproduce
- Open Nextcloud Calendar in Chrome on mobile.
- Edit an existing calendar event.
- Save the event.
- Inspect the resulting
PUTrequest to/remote.php/dav/calendars/<user>/<calendar>/<uid>.ics. - Observe that the
Content-Typeheader containscharset=UTF-8twice. - With ModSecurity and OWASP CRS enabled, observe rule
920530blocking the request.
Sanitized ModSecurity details
Request method: PUT
Request URI: /remote.php/dav/calendars/<user>/<calendar>/<uid>.ics
Relevant header: Content-Type: text/calendar; charset=UTF-8; component=vevent; charset=UTF-8
Response status: 404
Interrupted: true
ModSecurity: ModSecurity v3.0.15 (Linux)
Connector: ModSecurity-nginx v1.0.4
OWASP CRS: 4.25.0
Rule ID: 920530
Rule file: REQUEST-920-PROTOCOL-ENFORCEMENT.conf
Rule message: Multiple charsets detected in content type header
Matched data: text/calendar; charset=utf-8; component=vevent; charset=utf-8
Rule tags: attack-protocol, paranoia-level/1, OWASP_CRS/PROTOCOL-ENFORCEMENT
Private domain, username, IP addresses, cookies, request token, session identifiers, ETag, Cloudflare request identifiers, and server identifiers have been removed.
Environment
- Nextcloud Server version: unknown
- Calendar app version: unknown
- Browser: Chrome mobile on Android
- Reverse proxy / WAF: ModSecurity with OWASP Core Rule Set enabled
- ModSecurity version: 3.0.15
- ModSecurity nginx connector: 1.0.4
- OWASP CRS version: 4.25.0
Related references
This may be related to previous Content-Type handling work in the CalDAV library:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Calendar web UI's CalDAV PUT request for an event update and how its Content-Type header is assembled. Compare that handling with the related cdav-library issue #539 and pull request #540. Done means the request contains only one charset parameter and is no longer blocked by ModSecurity rule 920530.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100