Range Check Exception when using KDF with empty password
@MHumm đang làm issue này rồi.
Từ ngày 12/5/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
In my app, I noticed a "Range Check Exception" when the user didn't enter a password (which I clearly forgot to check), and therefore the, empty password was tried to be processed through KDF. The reason for the Range Check Exception is that Data[0] is accessed, which does not exist if Data is empty.
class function TDECHashAuthentication.KDFx(const Data, Seed: TBytes;
MaskSize: Integer;
Index: UInt32 = 1): TBytes;
begin
if (length(Seed) > 0) then
Result := KDFx(Data[0], Length(Data), Seed[0], Length(Seed), MaskSize, Index)
else
Result := KDFx(Data[0], Length(Data), NullStr, Length(Seed), MaskSize, Index)
end;
(This is just an example. Not only KDFx is affected. Other methods are affected too.)
It is dangerous that a method can fail this way, especially because "range check" can be disabled in the compiler settings for performance reasons.
In my opinion we should do the following: Find out (from official sources / reference implementation) what KDF123x/PBKDF/MGF1 is supposed to do if the input is 0 bytes. Is it supposed to fail, or is it supposed to return a key "X"?
- If it shall output a key "X", then we should implement it this way
- If it is supposed to fail, then we must throw an Exception instead of risking a memory-corruption if range checks are disabled
(edit: typo. of course I meant "instead of risking")
- Ngôn ngữ chính
- HTML
- Star
- 286
- Fork
- 78
- Merge trung bình
- 1 ngày 23 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MHumm/DelphiEncryptionCompendium
-
CRC64 - PKI AdditionCó thể làm lại được @MHumm đã nhận 150 ngày trước và không có pull request nào đang mở. Đang mởenhancement help wanted
MHumm/DelphiEncryptionCompendium#93 · 1 bình luận · 1 người được giao ·
-
Missing PUInt8Array type in the GetIt version.Có thể làm lại được @MHumm đã nhận 161 ngày trước và không có pull request nào đang mở. Đang mởbug delphi
MHumm/DelphiEncryptionCompendium#92 · 2 bình luận · 1 người được giao ·
-
Confused by NEXTGEN directiveCó thể làm lại được @MHumm đã nhận 532 ngày trước và không có pull request nào đang mở. Đang mởbug
MHumm/DelphiEncryptionCompendium#88 · 8 bình luận · 1 người được giao ·
-
Authenticated tag is wrong on streamsCó thể làm lại được @MHumm đã nhận 542 ngày trước và không có pull request nào đang mở. Đang mởbug
MHumm/DelphiEncryptionCompendium#87 · 20 bình luận · 1 người được giao ·
-
Support for AEGIS 256Có thể làm lại được @MHumm đã nhận 853 ngày trước và không có pull request nào đang mở. Đang mởenhancement help wanted
MHumm/DelphiEncryptionCompendium#77 · 3 bình luận · 1 reaction · 1 người được giao ·