Skip to content

Conversation

@arijanluiken
Copy link

@arijanluiken arijanluiken commented Dec 11, 2025

Overview

This PR addresses two critical security vulnerabilities identified in the MeshCore codebase:

  • Unsafe string operations leading to potential buffer overflows
  • Insufficient input validation in packet parsing

…alidation

- Issue meshcore-dev#3: Replace all strcpy/sprintf with strncpy/snprintf to prevent buffer overflows
  * Fixed CommonCLI.cpp: All command responses now use bounded string operations
  * Fixed RegionMap.cpp: Safe string copying for wildcard name
  * Removed password echoing (security issue)

- Issue meshcore-dev#7: Improve Packet::readFrom() validation
  * Add bounds checking before all memory operations
  * Validate minimum packet size upfront
  * Check transport codes fit in buffer before copying
  * Verify path_len and payload_len before memcpy
  * Prevent buffer overruns from malformed packets
@liquidraver
Copy link
Contributor

wow, readFrom() buffer overflow sounds plausible, that is the one that can be exploited without authentication I would focus only on that at first.

The others are.... already expecting a serial or admin access, so low priority IMHO.

also can't find MAX_SERIAL_MSG_SIZE deifned anywhere, where did you get it?

@arijanluiken
Copy link
Author

I did not define it, it should be 160.

- Matches the buffer size used in all example applications
- Required for the bounded string operations added in security fixes
#define WITH_BRIDGE
#endif

#define MAX_SERIAL_MSG_SIZE 160
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liquidraver was defined here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants