php / php/php-src

Heap hardening

Đang mở
#14,083 7 bình luận 9 reaction 0 người được giao Xem trên GitHub

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

Feature Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

Currently, PHP's heap implementation is ~trivial to exploit:

There are several hardening techniques that could/should be implemented, listed here in order of difficulty:

  • prevent unlink abuses:
    • #13943
    • #14339
  • prevent freelist-corruption via shadow-pointer à la XNU/linux/partitionAlloc/suhosin/…: #14054
  • Disable ZEND_MM_CUSTOM by default: #14570
  • Make some parts of _zend_mm_heap read-only at runtime: #14570
  • surround large allocations with guard-pages, as done in partitionAlloc, scudo, …
  • Freelist randomisation, see Linux' SLAB_FREELIST_RANDOM
  • isolate types in different heaps to make type confusion/use after free more difficult, as in kalloc_type. An additional benefit of type isolation + freelist bitmap is that we wouldn't need the object_store anymore to enumerate objects. A less invasive approach would be to simply isolate by size as done in partitionAlloc and Webkit's libpas
    • once this is done, heaps need to be pinned by size/type, to prevent an attacker from re-using the memory space of a destructed heap with one of different type/size.
    • a low-hanging fruit would be to allocate GET/POST/COOKIES into a separated heap, to reduce the reach of heap feng-shui: #14304
  • allocate strings and array buckets in GigaCages so that a corrupt length doesn't allow to access anything else than other strings/array buckets. This will significantly increase the virtual-memory usage though. this isn't doable since those structures have a maximum size of SIZE_MAX

cc @arnaud-lb @cfreal @therealcoiffeur

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Issue này là một kế hoạch hardening heap PHP trên phạm vi rộng, thay vì chỉ là thay đổi một file hoặc một test. Hãy bắt đầu bằng việc xem xét các kỹ thuật chưa được đánh dấu cùng các issue và thiết kế allocator được tham chiếu, sau đó thống nhất một phạm vi cụ thể với các maintainer. Để được coi là hoàn tất, cần triển khai một kỹ thuật hardening đã thống nhất và xác thực kỹ thuật đó trong các test allocator PHP liên quan.

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

Đánh giá

Công nghệ
c, php
Lĩnh vực
security
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

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.