jsdiff has a Denial of Service vulnerability in parsePatch and applyPatch

Đang mở
#1,617 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
security

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra khai báo dependency của BackstopJS đối với npm package diff và xác nhận phiên bản nào đang được cài đặt. Xem xét chi tiết về lỗ hổng trong parsePatch và applyPatch, sau đó xác minh rằng dependency ít nhất là phiên bản 8.0.3 và các test liên quan của project vẫn vượt qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Security Vulnerability: Denial of Service (DoS) in jsdiff

Vulnerability Overview

A vulnerability has been identified in jsdiff where certain line break characters can lead to an infinite loop and potential memory exhaustion.

Detail Description
Package diff (npm: jsdiff)
Affected Versions < 8.0.3
Patched Version 8.0.3

Impact

The parsePatch method is vulnerable to an infinite loop when processing filename headers containing specific line break characters: \r, \u2028, or \u2029.

Key risks:

  • Memory Exhaustion: The process will consume memory indefinitely until it crashes (Out of Memory).
  • Denial of Service (DoS): Attackers can trigger this with a very small payload; size limits on user input do not provide protection.
  • Affected Methods: Both parsePatch and applyPatch (when used with string inputs) are affected.
  • Secondary Issue: A lesser ReDOS (Regular Expression Denial of Service) exists in the patch header parsing, which can lead to $O(n^3)$ time complexity.

Patches

✅ All identified vulnerabilities have been fixed in v8.0.3.

Users are strongly encouraged to upgrade as soon as possible:

npm install [email protected]

See: https://github.com/kpdecker/jsdiff/pull/649

Ngôn ngữ chính
JavaScript
Star
7.2k
Fork
617
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của garris/BackstopJS

Tất cả issue của garris/BackstopJS

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.