Commit graph

4 commits

Author SHA1 Message Date
Vadim Peretokin
0f3a2d8092
fix: stop a malicious game from writing files outside the media folder (#9504)
#### Brief overview of PR changes/additions
- Reject MSP/GMCP media file names containing `..` that resolve outside
the profile's media directory (relative sub-directories and wildcards
still work).
- Guard `TEntityResolver::resolveCode()` against the empty value from a
malformed numeric entity like `&#;`, which previously called
`QString::front()` on an empty string (undefined behaviour).
- Add a `TEntityResolver` regression test for the malformed-entity case.

#### Motivation for adding to Mudlet
A connected game server could use a crafted MSP `!!SOUND`/`!!MUSIC` or
GMCP `Client.Media` file name to download and write attacker-controlled
content to an arbitrary path (e.g. an autostart entry), or read/play an
arbitrary local file — with no user interaction, since both protocols
are enabled by default.

#### Other info (issues closed, discussion etc)
Security hardening of the server-facing media path. `isFileRelative()`
only rejected absolute paths, so a relative `..` traversal passed
validation before being concatenated onto the media directory.

**Test case:** Connect a profile to a server that sends
`!!SOUND(../../evil.wav U=http://example/evil.wav)` — it is now rejected
with a `WARNING - rejected a media file name that escapes the profile
media directory` log line, while a normal `!!SOUND(hit.wav U=...)` still
downloads and plays.

---
_Generated by [Claude
Code](https://claude.ai/code/session_011XUZefuDuy8F1M4bHq5jMZ)_

---------

Signed-off-by: Vadim Peretokin <vperetokin@hey.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-07-25 17:23:31 +02:00
eowmob
2958e5c5e9
Improvement: Mxp entity & special character support in normal mud output (#6903)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Mudlet was only able to display entities with only one Latin1 character
in normal mud output.
This fix removes this restriction and also enables the use of special
characters represented by MXP default entities.
#### Motivation for adding to Mudlet
Improve MXP compliance
#### Other info (issues closed, discussion etc)
The patch changes small tidbits in several places: TBuffer was not able
to add additional characters to an input line, also the inserted entity
content must be reparsed to see if an MXP element is contained or to
interprete any non-Latin1 encoding while not risking a deadlock by
trying to resolve a recursive entity definition. This also required a
way for the entity resolver if a given entity is custom, default, or
unknown.

There are some screenshots and remarks at the end of
https://forums.mudlet.org/viewtopic.php?f=7&t=23206&start=10 .

Also, you can see how this works by connection to aldebaran-mud.de login
as a guest char (hit y to confirm) then "set mxp test 5", "set mxp test
6" or, for insights: "set mxp test 5 source", "set mxp test 6 source"
2024-08-31 15:33:24 +02:00
Vadim Peretokin
2ab7e59aeb
Infrastructure: update new instances of QStringLiteral to shorter qsl (#5760)
#### Brief overview of PR changes/additions
Update new instances of QStringLiteral to shorter qsl
#### Motivation for adding to Mudlet
Follow-up to https://github.com/Mudlet/Mudlet/pull/5640 for the new instances that have sneaked in with new PRs
#### Other info (issues closed, discussion etc)
Would be nice to have a danger check find these.
2021-12-14 22:03:20 +01:00
Gustavo Sousa
102491a743
Refactoring/reimplementation of MXP support (#3625)
Refactoring/reimplementation of MXP protocol
        Extracts MXP support from TBuffer
        Separates input parsing from protocol processing: input is parsed into MxpTag objects by the MxpNodeBuilder and are passed to be handled by the MxpTagProcessor
        Class hierarchy of MxpTagHandler for implementing support for each tag: allows for a clear separation of the implementation of each tag and makes it easier for adding support for new tags
        Defines a clear interface (MxpClient) separating the MXP implementation from other parts of the code
        Solves some limitations of previous implementation such as supporting element definitions not only for<SEND> tags, interpolating named and positional attributes and interpolating &text; placeholder by tag content
        Includes support for COLOR tag
        Handles FONT, U, I, B, VAR and !ENTITY tags, but so far no defined behavior (can be implemented in MxpMudlet)
        Attributes that hold MXP state are now in the Host class to avoid needless copies when TBuffer is copied around
        Introduces QtTests for some of the classes
    Other refactorings intended to simplify TBuffer class, extracting responbilities that aren't directly related to the buffer mgmt
        Extracted TEncodingTable from TBuffer, this class is responsible for mapping encoding names to tables. It also removes some bloat from TBuffer.
        TLinkStore to manage links and associated hints to be displayed.
        TEntityResolver to map character entities, such as &gt; &#32; &#x20; to their associated string values; supports interpolating strings replacing the entity placeholders by their values
2020-05-03 19:09:42 +02:00