Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CoBRA — 係数ベースの算術再構築 — 難読化解除のための Mixed Boolean-Arithmetic (MBA) 式簡約化ツール | Kitploit
ツール/GitHubGitHub/trailofbits/cobra
静的分析コード分析リバースエンジニアリング暗号化バイナリ解析
GitHubtrailofbits/cobra

CoBRA

係数ベースの算術再構築 — 難読化解除のための Mixed Boolean-Arithmetic (MBA) 式簡約化ツール

リポジトリを見る
323168日前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

CoBRA

Coefficient-Based Reconstruction of Arithmetic — 混合ブール算術(Mixed Boolean-Arithmetic)式の簡約化ツール。

License: Apache-2.0 C++23 Tests

CoBRAは、算術演算子(+, -, *)とビット演算子(&, |, ^, ~)、シフト演算子(<<, >>)を混在させた式の難読化を解除します。これはソフトウェア難読化で一般的に使われる手法です。

root@kitploit:~
$ cobra-cli --mba "(x&y)+(x|y)"
x + y

$ cobra-cli --mba "((a^b)|(a^c)) + 65469 * ~((a&(b&c))) + 65470 * (a&(b&c))" --bitwidth 16
67 + (a | b | c)

$ cobra-cli --mba "((a^b)&c) | ((a&b)^c)"
c ^ a & b

$ cobra-cli --mba "(x&0xFF)+(x&0xFF00)" --bitwidth 16
x

$ cobra-cli --mba "(x ^ 0x10) + 2 * (x & 0x10)"
16 + x

$ cobra-cli --mba "x << 3"
8 * x
その他の例
root@kitploit:~
$ cobra-cli --mba "~x"
~x

$ cobra-cli --mba "(x^y)*(x&y) + 3*(x|y)"
(x ^ y) * (x & y) + 3 * (x | y)

$ cobra-cli --mba '-357*(x&~y)*(x&y)+102*(x&~y)*(x&~y)+374*(x&~y)*~(x^y)
  -306*(x&~y)*~(x|y)-17*(x&~y)*~(x|~y)-105*~(x|~y)*(x&y)+30*~(x|~y)*(x&~y)
  +110*~(x|~y)*~(x^y)-90*~(x|~y)*~(x|y)-5*~(x|~y)*~(x|~y)+34*(x&~y)*~x
  -85*(x&~y)*~y+10*~(x|~y)*~x-25*~(x|~y)*~y'
22 * (x & y) + -17 * x + -5 * y

動作の仕組み

CoBRAは、ワークリストベースのオーケストレータを使用して式を簡約化します。各入力は、状態種別(state kind)がタグ付けされた作業項目としてワークリストに入ります。スケジューラは、項目の状態、前提となる依存関係、および冗長な作業を防ぐ試行キャッシュに基づいて、次に実行するパスを選択します。

36の個別パスは、AST処理、シグネチャベース手法、半線形手法、分解、リフティングというファミリに分類されます。一部のパスは、競合グループによって解決される局所的な代替案や子の解決をフォークします。これらのグループの外では、ワークリストは最初に完全に検証されたトップレベルの候補を返します。すべての結果は、ランダム入力のスポットチェック(デフォルト)またはZ3等価性証明(--verify)によって検証されます。

root@kitploit:~
Input Expression
       |
  [Worklist Scheduler]
       |
  Work items flow through state kinds:
       |
  kFoldedAst ──> AST processing passes
       |         (classify, lower, rewrite)
       |
       +──> kSignatureState ──> Signature techniques
       |    (pattern match, CoB, ANF, polynomial recovery)
       |
       +──> kSemilinearNormalizedIr ──> Semilinear techniques
       |    (normalize, recover structure, refine, reconstruct)
       |
       +──> kCoreCandidate / kRemainderState ──> Decomposition
       |    (extract core, classify residual, solve)
       |
       +──> kLiftedSkeleton ──> Lifting
       |    (virtual variable substitution, outer solve)
       |
       +──> kCandidateExpr ──> Verification
            (spot-check or Z3 proof)
       |
  Simplified Expression

シグネチャベース手法は、すべてのブール入力に対して式を評価してシグネチャベクトルを取得します。CoBバタフライ変換により、AND積基底の係数を復元します。パターンマッチング、ANF、多項式復元は、それぞれ異なる複雑度レベルを処理します。

半線形手法は、定数マスクを持つ式(例: x & 0xFF)を処理します。式を重み付きビット単位アトムに分解し、構造復元と項の精密化によって中間表現を簡約化した後、ビット分割ORアセンブリで最終結果を再構築します。

分解は、ビット単位部分式の積を持つ混合式を対象とします。多項式コアを抽出し、残差を分類して解決します(多項式、ブールヌル/ゴースト、またはテンプレートフォールバック)。

リフティングは、複雑な部分式を仮想変数に置き換え、簡約化された外側の骨格を解決してから、元に戻します。

特徴

  • 線形MBA簡約化 — シグネチャベクトルとCoB変換によるビット単位アトムの重み付き総和
  • スケーリング対応パターンマッチング — k * f(vars) + c とシャノン分解による4〜5変数ブール式の処理
  • 半線形サポート — XOR/OR/NOT-AND定数の低減化、構造復元、項の精密化、ビット分割再構築による定数マスク付きアトムの処理
  • 多項式復元 — 係数分割と有限差分による多重線形項と単独冪の復元
  • 混合積の処理 — コア抽出、残差解決、ゴースト残差分類を備えた分解エンジン
  • 部分式リフティング — 複雑な部分木を仮想変数に置き換えて問題の次元を削減
  • ワークリストオーケストレータ — 重複排除と探索範囲制限を備えたDAG対応パススケジューリング
  • 競合グループ — 局所的な代替分岐と子解決は、継続を用いたコストベースの勝者選択を使用
  • 定数シフト — << は乗算にデシュガーし、>> は半線形手法で簡約化
  • ANFクリーンアップ — 吸収則、共通キューブの因数分解、OR認識
  • 設定可能なビット幅 — 1〜64ビットのモジュラー算術
  • 補助変数の除去 — 項が相殺されるときに変数の数を削減
  • Z3検証 — 簡約化出力のオプションの等価性チェック
  • スポットチェック自己テスト — Z3が利用できない場合の軽量なランダム入力検証
  • LLVMパスプラグイン — コンパイラパイプラインへの直接統合(LLVM 19-22が必要)

ビルド

詳細(LLVM、Z3などのオプション依存関係を含む)はBUILD.mdを参照してください。

root@kitploit:~
# Build dependencies (Abseil, Highway; optionally GoogleTest, LLVM, Z3)
cmake -S dependencies -B build-deps -DCMAKE_BUILD_TYPE=Release
cmake --build build-deps

# Build CoBRA
cmake -S . -B build \
  -DCMAKE_PREFIX_PATH=$(pwd)/build-deps/install \
  -DCMAKE_BUILD_TYPE=Release
cmake --build build

# (Optional) Build and run tests
cmake -S dependencies -B build-deps -DCMAKE_BUILD_TYPE=Release -DCOBRA_BUILD_TESTS=ON
cmake --build build-deps
cmake -S . -B build \
  -DCMAKE_PREFIX_PATH=$(pwd)/build-deps/install \
  -DCMAKE_BUILD_TYPE=Release \
  -DCOBRA_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failure

LLVMパスプラグインを使用する場合

root@kitploit:~
cmake -S . -B build \
  -DCMAKE_PREFIX_PATH=$(pwd)/build-deps/install \
  -DCOBRA_BUILD_LLVM_PASS=ON \
  -DCMAKE_BUILD_TYPE=Release
cmake --build build

使い方

root@kitploit:~
# Basic simplification
cobra-cli --mba "(x&y)+(x|y)"

# Specify bitwidth
cobra-cli --mba "(x&0xFF)+(x&0xFF00)" --bitwidth 16

# Enable Z3 equivalence verification
cobra-cli --mba "(a^b)+(a&b)+(a&b)" --verify

# Verbose output (show intermediate pipeline steps)
cobra-cli --mba "(x&y)+(x|y)" --verbose

オプション

プロジェクト構成

root@kitploit:~
lib/core/                Core simplification engine (~50 source files)
  Orchestrator             Worklist scheduler, state machine, main simplification loop
  OrchestratorPasses       39-pass registry with DAG-aware scheduling
  CompetitionGroup         Multi-technique racing and winner selection
  ContinuationTypes        Deferred recombination data for pass composition
  JoinState                Multi-operand join tracking for structural rewrites
  SignatureSimplifier      Signature-based techniques (CoB, pattern matching, ANF)
  SignatureVector          Evaluate expression on {0,1}^n inputs
  AuxVarEliminator         Reduce variable count by detecting cancellations
  PatternMatcher           Recognize bitwise patterns (2-var/3-var tables, scaled)
  CoeffInterpolator        Butterfly interpolation for coefficient recovery
  CoBExprBuilder           Reconstruct expressions from CoB coefficients
  AnfTransform             Algebraic Normal Form conversion
  AnfCleanup               Absorption, factoring, OR recognition
  CoefficientSplitter      Separate bitwise vs. arithmetic contributions
  ArithmeticLowering       Lower arithmetic fragment to polynomial IR
  PolyNormalizer           Canonical form for polynomial expressions
  SingletonPowerRecovery   Detect x^k terms via finite differences
  DecompositionEngine      Extract-solve loop: polynomial core + residual solving
  GhostBasis               Ghost primitive library (mul_sub_and, mul3_sub_and3)
  GhostResidualSolver      Boolean-null classification and ghost residual solving
  WeightedPolyFit          2-adic weighted linear solve for polynomial quotients
  MixedProductRewriter     Expand bitwise products into linear sums
  TemplateDecomposer       Bounded template matching for mixed expressions
  ProductIdentityRecoverer Recover product-of-sums identities
  SemilinearNormalizer     Decompose into weighted bitwise atoms
  SemilinearSignature      Per-bit signature evaluation and linear shortcut
  StructureRecovery        XOR recovery, mask elimination, term coalescing
  TermRefiner              Dead-bit mask reduction, same-coefficient merge
  BitPartitioner           Group bit positions by semantic profile
  MaskedAtomReconstructor  Reassemble with OR-rewrite for disjoint masks
  Evaluator                Compiled expression evaluator

lib/llvm/                LLVM pass plugin (CobraPass, MBADetector, IRReconstructor)
lib/verify/              Z3-based equivalence verification
include/cobra/           Public headers
tools/cobra-cli/         CLI frontend and expression parser
test/                    1195 tests across ~63 test files

テスト

CoBRAには、ユニットテスト、統合テスト、データセットベンチマークを含む1195のテストがあります:

root@kitploit:~
# Run all tests
ctest --test-dir build --output-on-failure

# Run a specific test suite
ctest --test-dir build -R test_simplifier --output-on-failure

# Run with verbose output
ctest --test-dir build -V

データセットベンチマークは、複数の独立したソースからの実際の難読化式に対して検証を行います。完全なベンチマークレポートはDATASETS.mdを参照してください — 7つの独立したソースからの35のデータセットファイルにわたる75,126の式。

既知の制限

  • 深くインターリーブされた混合多項式MBA — 残りの未対応式は、主に算術演算子とビット演算子が混在する、大規模で重複の多いASTです。影響度順の部分式リフティングによってこれらの多くは復元されますが、リフティング後にワークリストの予算を使い果たす式は未対応のままです。
  • ブール領域での再構築の発散 — 一部の式では、{0,1}入力では正しいが全ビット幅では正しくないCoB候補が生成されます(AND積基底と算術乗算の違い)。これらは検出され、検証失敗として正しく報告されます。
  • 汎用の論理最小化はなし — CoBRAはQuine-McCluskey/Espresso/BDDではなく、貪欲な代数的書き換えを使用します。

謝辞

このプロジェクトの形成に貢献したインスピレーションとガイダンスを提供してくれたBas ZweersとBack Engineeringチームに感謝します。おすすめの動画: 彼らのre//verse 2026トーク Deobfuscation of a Real World Binary Obfuscator。

継続的なレビューとテストに協力してくれたJack Royer、Matteo Favaro、Arnau Gàmez、およびその他の匿名の貢献者にも感謝します。

ライセンス

Apache-2.0。test/datasets/内のテストデータセットは、サードパーティの研究プロジェクトから元のライセンス(主にGPL-3.0)のもとで再配布されています。詳細はTHIRD_PARTY_LICENSESを参照してください。

ツールをダウンロード
フラグデフォルト説明
--mba <expr>簡約化する式
--bitwidth <n>64モジュラー算術のビット幅(1〜64)
--max-vars <n>16最大変数数
--verifyoffZ3等価性チェック
--verboseoffパイプライン内部を表示