BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 962
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 423
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracy対応中かも @its-amann が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/PyRIT#3430 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>対応中かも @aatif101 が 3 日前に担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/PyRIT#3343 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
Detect Azure SAS tokens, SharedAccessKey connection strings, and Databricks PATs in CredentialLeakScorer対応中かも @nithin42 が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every request対応中かも @ShivamSharma43 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
microsoft/PyRIT#3445 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: get_jailbreak_templates(num_templates=0) returns every template and the Jailbreak scenario accepts num_jailbreaks below 1対応中かも @ShivamSharma43 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
microsoft/PyRIT#3417 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
style: article/section 📝 system: cloud.rc ☁️ system: security 🔐
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
uabrc/uabrc.github.io#1262 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
NCAR/miles-credit#526 ·
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
conda/conda-lock#957 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/sample-per-model-bedrock#464 ·
メンテナーはふだん 1 日以内に返信