BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged
Maintainer thường phản hồi trong vòng 2 ngà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
Hướng nghiên cứu
Start at LetterBijectionConverter and inspect how fixed_size is used to split the lowercase alphabet and build the identifier. Check the existing tests for fixed_size=0 and fixed_size=26, then add coverage for invalid values and verify they raise a ValueError naming fixed_size. A pull request is already open for this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
LetterBijectionConverter(fixed_size=...) uses fixed_size as a slice bound on the 26 lowercase letters (letters[:fixed_size] stay fixed, letters[fixed_size:] are shuffled) but never validates it. A negative value is read from the end of the alphabet instead of being rejected:
fixed_size=-1keeps the first 25 letters fixed and "shuffles" onlyzwith itself, so the mapping is the identity and the converter sends the prompt to the target unchanged (attack at dawn->attack at dawn).fixed_size=-3keeps 23 letters fixed and shuffles onlyx,y,z, so most prompts also go out in plaintext.fixed_size=27is accepted (identity mapping, identifier says27),Trueis accepted as1(identifier saysTrue), and2.5fails withslice indices must be integers or None or have an __index__ method.
The identifier records the invalid value, so a run looks like a bijection attack in memory while the target actually received plaintext.
Steps/Code to Reproduce
import asyncio
from pyrit.converter import LetterBijectionConverter
async def main():
for fixed_size in (-1, -3, 27, True, 2.5):
try:
converter = LetterBijectionConverter(fixed_size=fixed_size, seed=1)
unchanged = sum(1 for k, v in converter.mapping.items() if k == v)
output = (await converter.convert_async(prompt="attack at dawn")).output_text
print(repr(fixed_size), "unchanged letters:", unchanged, "->", output)
except Exception as e:
print(repr(fixed_size), "->", type(e).__name__, e)
asyncio.run(main())
Expected Results
fixed_size must be an integer from 0 to 26 (both already used: fixed_size=0 shuffles every letter and fixed_size=26 is tested as the identity mapping). Anything else raises a ValueError naming fixed_size.
Actual Results
-1 unchanged letters: 26 -> attack at dawn
-3 unchanged letters: 24 -> attack at dawn
27 unchanged letters: 26 -> attack at dawn
True unchanged letters: 3 -> axxagu ax badp
2.5 -> TypeError slice indices must be integers or None or have an __index__ method
Screenshots
N/A
Versions
- OS: Windows 11
- Python version: 3.11.9
- PyRIT version: installed from main (ac196e57) in editable mode
- Ngôn ngữ chính
- Python
- Star
- 4.6k
- Fork
- 962
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 417
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 microsoft/PyRIT
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracyCó thể đã có người làm @its-amann đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/PyRIT#3430 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>Có thể đã có người làm @aatif101 đã nhận 3 ngày trước. Đang mởBug: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/PyRIT#3343 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Detect Azure SAS tokens, SharedAccessKey connection strings, and Databricks PATs in CredentialLeakScorerCó thể đã có người làm @nithin42 đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every requestCó thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
microsoft/PyRIT#3445 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: get_jailbreak_templates(num_templates=0) returns every template and the Jailbreak scenario accepts num_jailbreaks below 1Có thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
microsoft/PyRIT#3417 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
gramaziokohler/compas_timber#870 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
autowarefoundation/autoware_carla_scenario#500 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue priority: low size: XS testing
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
cubrid-lab/cubrid-mcp-server#385 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue priority: low size: S testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100