net-snmp 3.29.1 → 3.29.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -15,6 +15,9 @@ requests](#pull-requests). Please prefer the issue tracker over
15
15
  emailing individual project contributors as your first engagement
16
16
  with the project.
17
17
 
18
+ Security vulnerabilities are the exception: please report them privately
19
+ as described in [SECURITY.md](SECURITY.md), not in the issue tracker.
20
+
18
21
  ## What to always do
19
22
 
20
23
  1. Please respect the hundreds of hours developers have spent writing and testing
package/README.md CHANGED
@@ -3812,6 +3812,16 @@ Example programs are included under the module's `example` directory.
3812
3812
 
3813
3813
  * Upgrade the Mocha test framework to version 12, clearing the outstanding `serialize-javascript` and `diff` security advisories from the dependency tree - both were development-only transitive dependencies of the test toolchain and were never part of the published package, so no user of the library was exposed. Running the test suite now requires Node.js `^20.19.0 || >=22.12.0`; the library itself is unaffected
3814
3814
 
3815
+ # Version 3.29.2 - 09/10/2026
3816
+
3817
+ * Reject a varbind list that ends with a truncated OID instead of looping forever - a short unauthenticated UDP packet whose varbind carried a lone OID tag with no length byte sent the varbind parser into an infinite loop, spinning the CPU at 100% or exhausting memory. Such packets are now rejected with a `ResponseInvalidError` carrying the new `EBadVarbindList` code, closing a network-reachable denial-of-service on agents, receivers, and session clients
3818
+
3819
+ # Version 3.29.3 - 19/11/2026
3820
+
3821
+ * Reject SNMPv3 messages with an empty user name except for engine ID discovery - a message with a zero-length user name and no authentication was accepted by agents and receivers as if it came from a configured user, letting an unauthenticated sender read and write an agent's objects (under the default access control model), reach proxied devices, and inject traps and informs into a receiver (GHSA-pg9p-672x-44jc). Such messages are now treated as coming from an unknown user, as RFC 3414 requires. Applications that relied on empty user names being accepted can restore that with the `disableAuthorization` option
3822
+
3823
+ * Enforce the Simple access control model on requests forwarded to a proxy - a request carrying a proxy context name was forwarded without checking the requesting user's access level, so a read-only user could write to a proxied device (GHSA-jjpx-x4gm-m546). Requests the user is not allowed to make are now answered with `noAccess` and are not forwarded
3824
+
3815
3825
  # License
3816
3826
 
3817
3827
  Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
package/index.js CHANGED
@@ -305,7 +305,8 @@ var ResponseInvalidCode = {
305
305
  11: "EUnexpectedReport",
306
306
  12: "EResponseNotHandled",
307
307
  13: "EUnexpectedResponse",
308
- 14: "ENotInTimeWindow"
308
+ 14: "ENotInTimeWindow",
309
+ 15: "EBadVarbindList"
309
310
  };
310
311
 
311
312
  _expandConstantObject (ResponseInvalidCode);
@@ -496,6 +497,9 @@ function readVarbindValue (buffer, type) {
496
497
  value = null;
497
498
  } else if (type == ObjectType.OID) {
498
499
  value = buffer.readOID ();
500
+ if (value == null)
501
+ throw new ResponseInvalidError ("Truncated OID in varbind list",
502
+ ResponseInvalidCode.EBadVarbindList);
499
503
  } else if (type == ObjectType.IpAddress) {
500
504
  value = readIpAddress (buffer);
501
505
  } else if (type == ObjectType.Counter) {
@@ -531,10 +535,14 @@ function readVarbinds (buffer, varbinds) {
531
535
  buffer.readSequence ();
532
536
 
533
537
  while (1) {
534
- buffer.readSequence ();
538
+ if ( buffer.readSequence () == null )
539
+ break;
535
540
  if ( buffer.peek () != ObjectType.OID )
536
541
  break;
537
542
  var oid = buffer.readOID ();
543
+ if (oid == null)
544
+ throw new ResponseInvalidError ("Truncated OID in varbind list",
545
+ ResponseInvalidCode.EBadVarbindList);
538
546
  var type = buffer.peek ();
539
547
 
540
548
  if (type == null)
@@ -1846,6 +1854,13 @@ Message.prototype.hasAuthoritativeEngineID = function () {
1846
1854
  this.msgSecurityParameters.msgAuthoritativeEngineID != "";
1847
1855
  };
1848
1856
 
1857
+ // An SNMPv3 engine ID discovery request (RFC 3414 section 4): a reportable
1858
+ // GetRequest that does not yet name the authoritative engine
1859
+ Message.prototype.isEngineDiscovery = function () {
1860
+ return this.version == Version3 && !! this.pdu && this.pdu.type == PduType.GetRequest &&
1861
+ ! this.hasAuthoritativeEngineID () && !! this.isReportable ();
1862
+ };
1863
+
1849
1864
  Message.prototype.createReportResponseMessage = function (engine, context, errorType) {
1850
1865
  var user = {
1851
1866
  name: "",
@@ -3322,6 +3337,18 @@ Listener.processIncoming = function (buffer, authorizer, callback) {
3322
3337
  callback (new RequestFailedError ("Local user not found and message requires authentication with user " +
3323
3338
  message.msgSecurityParameters.msgUserName));
3324
3339
  return;
3340
+ } else if ( ! authorizer.disableAuthorization && ! message.isEngineDiscovery () ) {
3341
+ // RFC 3414 section 2.4: a zero-length userName does not match any
3342
+ // user, and may only be used for snmpEngineID discovery
3343
+ if ( message.isReportable () ) {
3344
+ return {
3345
+ original: message,
3346
+ report: true,
3347
+ errorType: UsmErrorType.UNKNOWN_USER_NAME
3348
+ };
3349
+ }
3350
+ callback (new RequestFailedError ("Local user not found for message with empty user name"));
3351
+ return;
3325
3352
  } else {
3326
3353
  message.user = {
3327
3354
  name: "",
@@ -5246,8 +5273,7 @@ Agent.prototype.onMsg = function (socket, buffer, rinfo) {
5246
5273
  }
5247
5274
 
5248
5275
  // SNMPv3 discovery
5249
- if ( message.version == Version3 && message.pdu.type == PduType.GetRequest &&
5250
- ! message.hasAuthoritativeEngineID() && message.isReportable () ) {
5276
+ if ( message.isEngineDiscovery () ) {
5251
5277
  let reportMessage = message.createReportResponseMessage (this.engine, this.context, UsmErrorType.UNKNOWN_ENGINE_ID);
5252
5278
  this.listener.send (reportMessage, rinfo, socket);
5253
5279
  return;
@@ -5976,6 +6002,20 @@ Agent.prototype.onProxyRequest = function (socket, message, rinfo) {
5976
6002
  this.callback (new RequestFailedError ("No proxy found for message received with context " + contextName));
5977
6003
  return;
5978
6004
  }
6005
+ // The proxied request is sent with the proxy's own credentials, so the
6006
+ // requesting user's access level must be enforced here before forwarding
6007
+ if ( ! this.authorizer.isAccessAllowed (message.version, message.user.name, message.pdu.type) ) {
6008
+ var responsePdu = message.pdu.getResponsePduForRequest ();
6009
+ responsePdu.varbinds = message.pdu.varbinds.map (varbind => ({
6010
+ oid: varbind.oid,
6011
+ type: ObjectType.Null,
6012
+ value: null
6013
+ }));
6014
+ responsePdu.errorStatus = ErrorStatus.NoAccess;
6015
+ responsePdu.errorIndex = 1;
6016
+ this.sendResponse (socket, rinfo, message, responsePdu);
6017
+ return;
6018
+ }
5979
6019
  if ( ! proxy.session.msgSecurityParameters ) {
5980
6020
  // Discovery required - but chaining not implemented from here yet
5981
6021
  proxy.session.sendV3Discovery (null, null, this.callback, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.29.1",
3
+ "version": "3.29.3",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "author": "Mark Abrahams <mark@abrahams.co.nz>",
6
6
  "license": "MIT",