Skip to content

refactor: implement ttl-based assist-abandon dedup and improve credential relay logic#318

Merged
l50 merged 3 commits into
mainfrom
fix/relay-chain
May 15, 2026
Merged

refactor: implement ttl-based assist-abandon dedup and improve credential relay logic#318
l50 merged 3 commits into
mainfrom
fix/relay-chain

Conversation

@l50
Copy link
Copy Markdown
Contributor

@l50 l50 commented May 15, 2026

Key Changes:

  • Replace permanent assist-abandon dedup with TTL-based in-memory tracking for LLM task patterns
  • Refactor ADCS relay automation to correctly resolve relayed account home realm and KDC
  • Add helpers and extensive unit tests for credential relay and assist-abandon logic
  • Update report filtering to ensure NTLM hashes are output in correct format for scoreboards

Added:

  • TTL-based assist-abandoned pattern tracking using a timestamped HashMap on StateInner, with helpers for marking and checking abandonment
  • build_certipy_auth_args and resolve_relayed_account_realm functions to correctly construct relay arguments and resolve relayed account home domains/KDCs, including tests for all edge cases
  • Tests for new report_hash_value function, ensuring NTLM hashes are correctly normalized for report output

Changed:

  • Orchestrator's assist-abandon dedup now expires after 10 minutes, allowing re-dispatch if state changes (e.g., new creds), instead of a permanent per-op lockout
  • ADCS relay chain now uses relayed machine's true realm and KDC IP, resolving via state host/domain_controller data, improving cross-forest reliability
  • certipy_auth automation now consistently routes to the privesc toolset, fixing silent failures from toolset mismatch
  • Report filtering logic now outputs NTLM hashes as bare 32-char hex for scoreboards, with Kerberos blobs and other types unchanged
  • Removed DEDUP_ASSIST_ABANDONED from global dedup sets; assist-abandon logic is now managed in-memory with TTL, not persisted in Redis
  • Updated and clarified documentation and comments throughout affected modules for new flow and rationale
  • Various "Phase 2/Phase 4" rollout comments updated or removed for clarity, as Redis and JetStream cutover details are no longer relevant to the code paths

Removed:

  • Permanent, Redis-backed assist_abandoned dedup set and all related persistence and references
  • Legacy code paths and comments tied to previous dual-write and phase rollout logic for op-state recording and deduplication

l50 added 2 commits May 15, 2026 08:13
…phase

**Added:**

- Introduced `build_certipy_auth_args` function to construct certipy_auth argument JSON, ensuring consistent keying and preventing silent failures in relay chain phase 2
- Added unit tests for `build_certipy_auth_args` to validate key requirements, optional field omission, and regression against previous keying issues

**Changed:**

- Replaced inline construction of certipy_auth arguments in `dispatch_relay_coerce_chain` with the new `build_certipy_auth_args` function for improved maintainability and test coverage

**Removed:**

- Eliminated legacy use of the `"pfx"` key in certipy_auth argument construction, enforcing use of `"pfx_path"` as required by downstream tools
…realm resolution

**Added:**

- Introduced `resolve_relayed_account_realm` to determine the correct realm and KDC IP for relayed accounts in cross-forest ADCS exploitation, ensuring certipy_auth targets the appropriate domain and avoids authentication errors
- Added in-memory TTL-based tracking for assist-abandoned task patterns via `assist_abandoned_at` in `StateInner`, enabling expired patterns to be retried after a configurable window (`ASSIST_ABANDONED_TTL_SECS`)
- Added comprehensive unit tests for both assist-abandoned TTL behavior and relay realm resolution logic

**Changed:**

- Updated certipy_auth dispatch to use the resolved realm and KDC IP, supporting cross-forest scenarios and preventing unnecessary authentication failures
- Reworked assist-abandon deduplication to use TTL-based in-memory tracking instead of the generic dedup set, allowing patterns to expire and be retried when state changes
- Modified dispatcher logic to check and mark assist-abandoned patterns using the new TTL approach, including relevant logging and comments
- Adjusted documentation to reflect the move away from the static dedup set for assist-abandon tracking

**Removed:**

- Removed `DEDUP_ASSIST_ABANDONED` from the dedup set list and related logic, as assist-abandon deduplication is now handled with per-pattern TTLs in state
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 90.97473% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.81%. Comparing base (b147f59) to head (5699d10).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...i/src/orchestrator/automation/adcs_exploitation.rs 91.36% 19 Missing ⚠️
ares-cli/src/orchestrator/dispatcher/submission.rs 0.00% 5 Missing ⚠️
...es-cli/src/orchestrator/automation/certipy_auth.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   78.76%   78.81%   +0.04%     
==========================================
  Files         439      439              
  Lines      124213   124461     +248     
==========================================
+ Hits        97840    98091     +251     
+ Misses      26373    26370       -3     
Files with missing lines Coverage Δ
ares-cli/src/ops/replay.rs 0.00% <ø> (ø)
ares-cli/src/orchestrator/mod.rs 0.00% <ø> (ø)
ares-cli/src/orchestrator/state/dedup.rs 96.03% <ø> (ø)
ares-cli/src/orchestrator/state/inner.rs 92.55% <100.00%> (+0.58%) ⬆️
ares-cli/src/orchestrator/state/mod.rs 97.87% <ø> (ø)
...i/src/orchestrator/state/publishing/credentials.rs 89.22% <ø> (ø)
...res-cli/src/orchestrator/state/publishing/hosts.rs 90.02% <ø> (ø)
ares-cli/src/orchestrator/state/publishing/mod.rs 97.60% <ø> (ø)
ares-cli/src/orchestrator/state/replay.rs 76.50% <ø> (ø)
ares-core/src/nats.rs 76.07% <ø> (ø)
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

**Added:**

- Introduced `assist_abandoned_at` timestamped HashMap in `StateInner` to track assist-abandoned patterns with a 10-minute TTL
- Implemented `mark_assist_abandoned`, `mark_assist_abandoned_at`, `is_assist_abandoned`, and `is_assist_abandoned_at` methods on `StateInner` for marking and checking assist-abandoned status
- Added comprehensive unit tests for TTL-based assist-abandoned logic in `state/inner.rs`
- Added `resolve_relayed_account_realm` function to correctly select realm/KDC for relayed accounts, with extensive tests in `adcs_exploitation.rs`

**Changed:**

- Updated dispatch logic to use TTL-based assist-abandon tracking instead of permanent dedup set in `dispatcher/submission.rs`
- Modified documentation and comments to reflect the new assist-abandon mechanism and removed references to phase-based dedup logic
- Refactored credential, host, and event publishing to remove phase-specific comments and clarify operation
- Enhanced relay/coerce automation to resolve relayed account realm/KDC dynamically, ensuring correct authentication across cross-forest boundaries in `adcs_exploitation.rs`
- Updated `auto_certipy_auth` to route certipy_auth tasks to the correct toolset, preventing wasted LLM cycles on unavailable tools

**Removed:**

- Eliminated the `DEDUP_ASSIST_ABANDONED` constant and its use in dedup set lists and related documentation
- Removed phase-specific and dual-write migration comments throughout orchestrator modules for clarity and current relevance
@l50 l50 merged commit ef9b34c into main May 15, 2026
12 checks passed
@l50 l50 deleted the fix/relay-chain branch May 15, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant