rea-agents 5.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compatibleSlice, directoryOf, expandPrefix, joinPath, resolveTreePath, } from "./dyldPaths.js";
|
|
3
|
+
import { digestSchema } from "../digests.js";
|
|
4
|
+
import { hasApplicableDyldOverrides, embeddedDyldOverrides, } from "./dyldEnvironment.js";
|
|
5
|
+
import { DYLIB_RESOLUTION_LIMITATIONS, deriveFindings, } from "./dylibResolutionFindings.js";
|
|
6
|
+
/** Normalized path below the analyzed root: no `.`/`..` or empty segments. */
|
|
7
|
+
const ROOT_RELATIVE_PATH = /^(?!\/)(?!(?:.*\/)?\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$)[^\\\0]+$/u;
|
|
8
|
+
const rootRelativePathSchema = z.string().min(1).regex(ROOT_RELATIVE_PATH);
|
|
9
|
+
/** Caller selection of process roots and one CPU slice. */
|
|
10
|
+
export const dylibResolutionInputSchema = z.strictObject({
|
|
11
|
+
roots: z.array(rootRelativePathSchema).min(1).optional(),
|
|
12
|
+
architecture: z.enum(["arm64", "arm64e", "x86_64"]).optional(),
|
|
13
|
+
});
|
|
14
|
+
const dependencyCommandSchema = z.enum([
|
|
15
|
+
"LC_LOAD_DYLIB",
|
|
16
|
+
"LC_LOAD_WEAK_DYLIB",
|
|
17
|
+
"LC_REEXPORT_DYLIB",
|
|
18
|
+
"LC_LAZY_LOAD_DYLIB",
|
|
19
|
+
"LC_LOAD_UPWARD_DYLIB",
|
|
20
|
+
]);
|
|
21
|
+
const dependencySchema = z.strictObject({
|
|
22
|
+
command: dependencyCommandSchema,
|
|
23
|
+
encoding: z.enum(["dylib_command", "dylib_use_command"]),
|
|
24
|
+
install_name: z.string(),
|
|
25
|
+
weak: z.boolean(),
|
|
26
|
+
upward: z.boolean(),
|
|
27
|
+
reexport: z.boolean(),
|
|
28
|
+
delayed_init: z.boolean(),
|
|
29
|
+
current_version: z.string(),
|
|
30
|
+
compatibility_version: z.string(),
|
|
31
|
+
});
|
|
32
|
+
/** Observed dylib-loading facts of one Mach-O slice. */
|
|
33
|
+
export const machoSliceSchema = z.strictObject({
|
|
34
|
+
architecture: z.string().min(1),
|
|
35
|
+
/** Physical identity observed in the thin header and, for FAT, its table. */
|
|
36
|
+
slice_offset: z.number().int().nonnegative(),
|
|
37
|
+
slice_size: z.number().int().positive(),
|
|
38
|
+
cpu_type: z.number().int().nonnegative(),
|
|
39
|
+
cpu_subtype: z.number().int().nonnegative(),
|
|
40
|
+
fat_cpu_type: z.number().int().nonnegative().nullable(),
|
|
41
|
+
fat_cpu_subtype: z.number().int().nonnegative().nullable(),
|
|
42
|
+
fat_alignment_exponent: z.number().int().nonnegative().nullable(),
|
|
43
|
+
file_type: z.enum(["execute", "dylib", "bundle", "other"]),
|
|
44
|
+
file_type_code: z.number().int().nonnegative(),
|
|
45
|
+
/** Raw LC_BUILD_VERSION platform number; null means no such command was observed. */
|
|
46
|
+
platform: z.number().int().nonnegative().nullable(),
|
|
47
|
+
/** Every distinct build platform declared by LC_BUILD_VERSION/version-min commands. */
|
|
48
|
+
platforms: z.array(z.number().int().nonnegative()),
|
|
49
|
+
install_name: z.string().nullable(),
|
|
50
|
+
dependencies: z.array(dependencySchema),
|
|
51
|
+
rpaths: z.array(z.string()),
|
|
52
|
+
dyld_environment: z.array(z.string()),
|
|
53
|
+
code_signature_present: z.boolean(),
|
|
54
|
+
});
|
|
55
|
+
const candidateSchema = z.strictObject({
|
|
56
|
+
path: z.string(),
|
|
57
|
+
source: z.enum([
|
|
58
|
+
"literal",
|
|
59
|
+
"executable_path",
|
|
60
|
+
"loader_path",
|
|
61
|
+
"rpath",
|
|
62
|
+
"already-loaded",
|
|
63
|
+
]),
|
|
64
|
+
rpath: z.string().nullable(),
|
|
65
|
+
rpath_owner: z.string().nullable(),
|
|
66
|
+
outcome: z.enum([
|
|
67
|
+
"resolved",
|
|
68
|
+
"absent",
|
|
69
|
+
"not-mach-o",
|
|
70
|
+
"malformed",
|
|
71
|
+
"unsupported",
|
|
72
|
+
"architecture-missing",
|
|
73
|
+
"not-loadable",
|
|
74
|
+
"platform-mismatch",
|
|
75
|
+
"outside-target",
|
|
76
|
+
"escapes-target",
|
|
77
|
+
"undetermined",
|
|
78
|
+
]),
|
|
79
|
+
resolved_path: z.string().nullable(),
|
|
80
|
+
});
|
|
81
|
+
const edgeSchema = z.strictObject({
|
|
82
|
+
root: z.string(),
|
|
83
|
+
architecture: z.string(),
|
|
84
|
+
loader: z.string(),
|
|
85
|
+
via: z.array(z.string()),
|
|
86
|
+
...dependencySchema.shape,
|
|
87
|
+
candidates: z.array(candidateSchema),
|
|
88
|
+
resolution: z.strictObject({
|
|
89
|
+
status: z.enum(["resolved", "conditional", "unresolved", "undetermined"]),
|
|
90
|
+
image: z.string().nullable(),
|
|
91
|
+
}),
|
|
92
|
+
install_name_matches: z.boolean().nullable(),
|
|
93
|
+
/**
|
|
94
|
+
* The loader was reached through a conditional edge, so it might not load;
|
|
95
|
+
* this edge describes what happens only if it does.
|
|
96
|
+
*/
|
|
97
|
+
loader_conditional: z.boolean(),
|
|
98
|
+
});
|
|
99
|
+
const findingSchema = z.strictObject({
|
|
100
|
+
kind: z.enum([
|
|
101
|
+
"required-load-unresolved",
|
|
102
|
+
"weak-load-unresolved",
|
|
103
|
+
"lazy-load-unresolved",
|
|
104
|
+
"earlier-rpath-candidate-absent",
|
|
105
|
+
"dyld-environment-present",
|
|
106
|
+
]),
|
|
107
|
+
edge_index: z.number().int().nonnegative().nullable(),
|
|
108
|
+
image: z.string().nullable(),
|
|
109
|
+
basis: z.literal("derived"),
|
|
110
|
+
explanation: z.string().min(1),
|
|
111
|
+
});
|
|
112
|
+
const imageSchema = z.strictObject({
|
|
113
|
+
path: z.string(),
|
|
114
|
+
sha256: digestSchema,
|
|
115
|
+
parse_status: z.enum(["parsed", "malformed", "unsupported"]),
|
|
116
|
+
reason: z.string().nullable(),
|
|
117
|
+
slices: z.array(machoSliceSchema.omit({ dependencies: true })),
|
|
118
|
+
});
|
|
119
|
+
/** Static dyld load-path resolution for every selected process root. */
|
|
120
|
+
export const dylibResolutionResultSchema = z.strictObject({
|
|
121
|
+
root_path: z.string(),
|
|
122
|
+
target_sha256: digestSchema,
|
|
123
|
+
roots: z.array(z.strictObject({ image: z.string(), architecture: z.string() })),
|
|
124
|
+
images: z.array(imageSchema),
|
|
125
|
+
edges: z.array(edgeSchema),
|
|
126
|
+
findings: z.array(findingSchema),
|
|
127
|
+
coverage: z.strictObject({
|
|
128
|
+
status: z.enum(["complete", "partial"]),
|
|
129
|
+
unparsed_images: z.array(z.string()),
|
|
130
|
+
roots_without_architecture: z.array(z.string()),
|
|
131
|
+
}),
|
|
132
|
+
limitations: z.array(z.string().min(1)),
|
|
133
|
+
});
|
|
134
|
+
const candidateTemplates = (dependency, loader, context) => {
|
|
135
|
+
const name = dependency.install_name;
|
|
136
|
+
if (!name.startsWith("@rpath/")) {
|
|
137
|
+
const source = name.startsWith("@executable_path")
|
|
138
|
+
? "executable_path"
|
|
139
|
+
: name.startsWith("@loader_path")
|
|
140
|
+
? "loader_path"
|
|
141
|
+
: "literal";
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
expansion: expandPrefix(name, {
|
|
145
|
+
ownerDirectory: directoryOf(loader),
|
|
146
|
+
executable: context.executable,
|
|
147
|
+
}),
|
|
148
|
+
source,
|
|
149
|
+
rpath: null,
|
|
150
|
+
rpathOwner: null,
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
const rest = name.slice("@rpath/".length);
|
|
155
|
+
const owners = [...(context.loaded.get(loader)?.chain ?? [loader])].reverse();
|
|
156
|
+
return owners.flatMap((owner) => (context.loaded.get(owner)?.slice.rpaths ?? []).map((rpath) => {
|
|
157
|
+
const base = expandPrefix(rpath, {
|
|
158
|
+
ownerDirectory: directoryOf(owner),
|
|
159
|
+
executable: context.executable,
|
|
160
|
+
});
|
|
161
|
+
const expansion = {
|
|
162
|
+
scope: base.scope,
|
|
163
|
+
path: base.scope === "outside"
|
|
164
|
+
? `${base.path.replace(/\/+$/u, "")}/${rest}`
|
|
165
|
+
: joinPath(base.path, rest),
|
|
166
|
+
};
|
|
167
|
+
return { expansion, source: "rpath", rpath, rpathOwner: owner };
|
|
168
|
+
}));
|
|
169
|
+
};
|
|
170
|
+
const evaluateCandidate = async (template, context) => {
|
|
171
|
+
const base = {
|
|
172
|
+
path: template.expansion.path,
|
|
173
|
+
source: template.source,
|
|
174
|
+
rpath: template.rpath,
|
|
175
|
+
rpath_owner: template.rpathOwner,
|
|
176
|
+
};
|
|
177
|
+
if (template.expansion.scope === "outside")
|
|
178
|
+
return { ...base, outcome: "outside-target", resolved_path: null };
|
|
179
|
+
if (template.expansion.scope === "undetermined")
|
|
180
|
+
return { ...base, outcome: "undetermined", resolved_path: null };
|
|
181
|
+
const lookup = await resolveTreePath(context.view, template.expansion.path);
|
|
182
|
+
if (lookup.kind === "escapes")
|
|
183
|
+
return { ...base, outcome: "escapes-target", resolved_path: null };
|
|
184
|
+
if (lookup.kind !== "file")
|
|
185
|
+
return { ...base, outcome: "absent", resolved_path: null };
|
|
186
|
+
const facts = await imageFacts(context, lookup.path);
|
|
187
|
+
let outcome;
|
|
188
|
+
if (facts.status !== "parsed")
|
|
189
|
+
outcome = facts.status;
|
|
190
|
+
else {
|
|
191
|
+
const slice = compatibleSlice(facts.slices, context.architecture);
|
|
192
|
+
if (slice === undefined)
|
|
193
|
+
outcome = "architecture-missing";
|
|
194
|
+
// Dependency commands require a dylib; generic dyld image loadability
|
|
195
|
+
// also admits main executables and bundles for different operations.
|
|
196
|
+
else if (slice.file_type_code !== 6)
|
|
197
|
+
outcome = "not-loadable";
|
|
198
|
+
else {
|
|
199
|
+
const platformResult = platformLoadability(context.platforms, slice.platforms, slice.file_type_code, context.architecture);
|
|
200
|
+
outcome =
|
|
201
|
+
platformResult === "compatible"
|
|
202
|
+
? "resolved"
|
|
203
|
+
: platformResult === "incompatible"
|
|
204
|
+
? "platform-mismatch"
|
|
205
|
+
: "undetermined";
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return { ...base, outcome, resolved_path: lookup.path };
|
|
209
|
+
};
|
|
210
|
+
/** Apply dyld's documented cross-platform load cases and retain uncertain host cases. */
|
|
211
|
+
const platformLoadability = (processPlatforms, imagePlatforms, fileType, architecture) => {
|
|
212
|
+
if (processPlatforms.length === 0 || imagePlatforms.length === 0)
|
|
213
|
+
return "unknown";
|
|
214
|
+
const outcomes = processPlatforms.map((processPlatform) => imageLoadabilityForPlatform(processPlatform, imagePlatforms, fileType, architecture));
|
|
215
|
+
if (outcomes.every((outcome) => outcome === "compatible"))
|
|
216
|
+
return "compatible";
|
|
217
|
+
if (outcomes.every((outcome) => outcome === "incompatible"))
|
|
218
|
+
return "incompatible";
|
|
219
|
+
return "unknown";
|
|
220
|
+
};
|
|
221
|
+
const imageLoadabilityForPlatform = (processPlatform, imagePlatforms, fileType, architecture) => {
|
|
222
|
+
if (imagePlatforms.includes(processPlatform))
|
|
223
|
+
return "compatible";
|
|
224
|
+
// These are explicit dyld loadableIntoProcess cross-platform cases.
|
|
225
|
+
if (processPlatform === 6 && imagePlatforms.includes(1))
|
|
226
|
+
return "compatible"; // macOS dylibs in Mac Catalyst processes
|
|
227
|
+
if (processPlatform === 2 && imagePlatforms.includes(6))
|
|
228
|
+
return "compatible"; // Catalyst dylibs in iOS processes
|
|
229
|
+
if (processPlatform === 2 && imagePlatforms.includes(11))
|
|
230
|
+
return "compatible"; // visionOS dylibs in iOS processes
|
|
231
|
+
if (processPlatform === 7 && imagePlatforms.includes(12))
|
|
232
|
+
return "compatible"; // visionOS simulator dylibs in iOS simulator processes
|
|
233
|
+
if (processPlatform === 1 && fileType === 2 && imagePlatforms.includes(6))
|
|
234
|
+
return "compatible"; // Catalyst main executables run on macOS
|
|
235
|
+
// dyld's remaining exceptions depend on host architecture or a special path.
|
|
236
|
+
if ((processPlatform === 2 &&
|
|
237
|
+
imagePlatforms.includes(1) &&
|
|
238
|
+
architecture.startsWith("arm64")) ||
|
|
239
|
+
([7, 8, 9].includes(processPlatform) && imagePlatforms.includes(1)))
|
|
240
|
+
return "unknown";
|
|
241
|
+
if (isKnownPlatform(processPlatform) && imagePlatforms.every(isKnownPlatform))
|
|
242
|
+
return "incompatible";
|
|
243
|
+
return "unknown";
|
|
244
|
+
};
|
|
245
|
+
const isKnownPlatform = (platform) => platform >= 1 && platform <= 12;
|
|
246
|
+
const imageFacts = async (context, path) => {
|
|
247
|
+
const known = context.images.get(path);
|
|
248
|
+
if (known !== undefined)
|
|
249
|
+
return known;
|
|
250
|
+
const facts = await context.view.image(path);
|
|
251
|
+
context.images.set(path, facts);
|
|
252
|
+
return facts;
|
|
253
|
+
};
|
|
254
|
+
const resolution = (candidates) => {
|
|
255
|
+
let external = false;
|
|
256
|
+
for (const candidate of candidates) {
|
|
257
|
+
if (candidate.outcome === "resolved")
|
|
258
|
+
return {
|
|
259
|
+
status: external ? "conditional" : "resolved",
|
|
260
|
+
image: candidate.resolved_path,
|
|
261
|
+
};
|
|
262
|
+
// dyld might load these; REA cannot decide them from the analyzed root.
|
|
263
|
+
if (candidate.outcome === "outside-target" ||
|
|
264
|
+
candidate.outcome === "escapes-target" ||
|
|
265
|
+
candidate.outcome === "unsupported" ||
|
|
266
|
+
candidate.outcome === "undetermined")
|
|
267
|
+
external = true;
|
|
268
|
+
}
|
|
269
|
+
return { status: external ? "undetermined" : "unresolved", image: null };
|
|
270
|
+
};
|
|
271
|
+
const resolveDependency = async (dependency, loader, context) => {
|
|
272
|
+
const current = context.loaded.get(loader);
|
|
273
|
+
const chain = current?.chain ?? [loader];
|
|
274
|
+
const loaded = context.byInstallName.get(dependency.install_name);
|
|
275
|
+
const candidates = [];
|
|
276
|
+
if (loaded !== undefined)
|
|
277
|
+
candidates.push({
|
|
278
|
+
path: dependency.install_name,
|
|
279
|
+
source: "already-loaded",
|
|
280
|
+
rpath: null,
|
|
281
|
+
rpath_owner: null,
|
|
282
|
+
outcome: "resolved",
|
|
283
|
+
resolved_path: loaded,
|
|
284
|
+
});
|
|
285
|
+
else
|
|
286
|
+
for (const template of candidateTemplates(dependency, loader, context)) {
|
|
287
|
+
const candidate = await evaluateCandidate(template, context);
|
|
288
|
+
candidates.push(candidate);
|
|
289
|
+
// dyld stops at the first loadable candidate.
|
|
290
|
+
if (candidate.outcome === "resolved")
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
const modeled = resolution(candidates);
|
|
294
|
+
const searchUnknown = loaded === undefined &&
|
|
295
|
+
hasApplicableDyldOverrides(context.searchOverrides, dependency.install_name, modeled.image !== null);
|
|
296
|
+
if (searchUnknown)
|
|
297
|
+
context.environmentRoots.add(context.root);
|
|
298
|
+
// Fallbacks cannot preempt a modeled hit, and framework paths do not
|
|
299
|
+
// override ordinary dylibs. Reuse inherits uncertainty from the first load.
|
|
300
|
+
const searched = searchUnknown
|
|
301
|
+
? {
|
|
302
|
+
...modeled,
|
|
303
|
+
status: modeled.image === null ? "undetermined" : "conditional",
|
|
304
|
+
}
|
|
305
|
+
: modeled;
|
|
306
|
+
// Reusing an image that itself loads only conditionally is conditional too.
|
|
307
|
+
const resolved = loaded !== undefined &&
|
|
308
|
+
context.loaded.get(loaded)?.conditional === true &&
|
|
309
|
+
searched.status === "resolved"
|
|
310
|
+
? { ...searched, status: "conditional" }
|
|
311
|
+
: searched;
|
|
312
|
+
const image = resolved.image === null ? undefined : context.images.get(resolved.image);
|
|
313
|
+
const slice = image?.status === "parsed"
|
|
314
|
+
? compatibleSlice(image.slices, context.architecture)
|
|
315
|
+
: undefined;
|
|
316
|
+
return {
|
|
317
|
+
root: context.root,
|
|
318
|
+
architecture: context.architecture,
|
|
319
|
+
loader,
|
|
320
|
+
via: [...chain],
|
|
321
|
+
...dependency,
|
|
322
|
+
candidates,
|
|
323
|
+
resolution: resolved,
|
|
324
|
+
install_name_matches: slice === undefined || slice.install_name === null
|
|
325
|
+
? null
|
|
326
|
+
: slice.install_name === dependency.install_name,
|
|
327
|
+
loader_conditional: current?.conditional ?? false,
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Follow dyld4's dependents-first order: resolve every dependency of one
|
|
332
|
+
* image, then recurse into the images it newly loaded, in load-command order.
|
|
333
|
+
*/
|
|
334
|
+
const traceProcess = async (context, rootSlice, signal) => {
|
|
335
|
+
const edges = [];
|
|
336
|
+
context.loaded.set(context.root, {
|
|
337
|
+
slice: rootSlice,
|
|
338
|
+
chain: [context.root],
|
|
339
|
+
conditional: false,
|
|
340
|
+
});
|
|
341
|
+
if (rootSlice.install_name !== null)
|
|
342
|
+
context.byInstallName.set(rootSlice.install_name, context.root);
|
|
343
|
+
const pending = [context.root];
|
|
344
|
+
while (pending.length > 0) {
|
|
345
|
+
signal?.throwIfAborted();
|
|
346
|
+
const loader = pending.pop() ?? "";
|
|
347
|
+
const current = context.loaded.get(loader);
|
|
348
|
+
if (current === undefined)
|
|
349
|
+
continue;
|
|
350
|
+
const created = [];
|
|
351
|
+
for (const dependency of current.slice.dependencies) {
|
|
352
|
+
const edge = await resolveDependency(dependency, loader, context);
|
|
353
|
+
edges.push(edge);
|
|
354
|
+
// dyld loads LC_LAZY_LOAD_DYLIB images on first use, not at launch.
|
|
355
|
+
if (dependency.command === "LC_LAZY_LOAD_DYLIB")
|
|
356
|
+
continue;
|
|
357
|
+
const image = edge.resolution.image;
|
|
358
|
+
if (image === null || context.loaded.has(image))
|
|
359
|
+
continue;
|
|
360
|
+
const facts = context.images.get(image);
|
|
361
|
+
const slice = facts?.status === "parsed"
|
|
362
|
+
? compatibleSlice(facts.slices, context.architecture)
|
|
363
|
+
: undefined;
|
|
364
|
+
if (slice === undefined)
|
|
365
|
+
continue;
|
|
366
|
+
context.loaded.set(image, {
|
|
367
|
+
slice,
|
|
368
|
+
chain: [...current.chain, image],
|
|
369
|
+
// dyld may load an unknown earlier candidate instead of this fallback.
|
|
370
|
+
conditional: current.conditional || edge.resolution.status === "conditional",
|
|
371
|
+
});
|
|
372
|
+
if (slice.install_name !== null &&
|
|
373
|
+
!context.byInstallName.has(slice.install_name))
|
|
374
|
+
context.byInstallName.set(slice.install_name, image);
|
|
375
|
+
created.push(image);
|
|
376
|
+
}
|
|
377
|
+
pending.push(...created.reverse());
|
|
378
|
+
}
|
|
379
|
+
return edges;
|
|
380
|
+
};
|
|
381
|
+
/** Trace dyld load paths from each process root through the analyzed root. */
|
|
382
|
+
export const traceDylibLoading = async (view, request) => {
|
|
383
|
+
const images = new Map();
|
|
384
|
+
for (const path of request.unclassified ?? [])
|
|
385
|
+
images.set(path, await view.image(path));
|
|
386
|
+
const roots = [];
|
|
387
|
+
const edges = [];
|
|
388
|
+
const withoutArchitecture = [];
|
|
389
|
+
const environmentRoots = new Set();
|
|
390
|
+
for (const root of request.roots) {
|
|
391
|
+
const facts = await view.image(root);
|
|
392
|
+
images.set(root, facts);
|
|
393
|
+
if (facts.status !== "parsed")
|
|
394
|
+
continue;
|
|
395
|
+
const slices = facts.slices.filter(({ architecture }) => request.architecture === undefined ||
|
|
396
|
+
architecture === request.architecture);
|
|
397
|
+
if (slices.length === 0)
|
|
398
|
+
withoutArchitecture.push(root);
|
|
399
|
+
for (const slice of slices) {
|
|
400
|
+
const executable = slice.file_type === "execute" ? root : null;
|
|
401
|
+
// Only the main executable supplies the process's embedded environment.
|
|
402
|
+
const searchOverrides = executable === null
|
|
403
|
+
? []
|
|
404
|
+
: embeddedDyldOverrides(slice.dyld_environment, slice.platforms);
|
|
405
|
+
// Inserted libraries introduce unexamined images even without dependencies.
|
|
406
|
+
if (searchOverrides.some(({ variable, value }) => variable === "DYLD_INSERT_LIBRARIES" && value !== ""))
|
|
407
|
+
environmentRoots.add(root);
|
|
408
|
+
roots.push({ image: root, architecture: slice.architecture });
|
|
409
|
+
edges.push(...(await traceProcess({
|
|
410
|
+
view,
|
|
411
|
+
root,
|
|
412
|
+
architecture: slice.architecture,
|
|
413
|
+
searchOverrides,
|
|
414
|
+
environmentRoots,
|
|
415
|
+
platforms: slice.platforms,
|
|
416
|
+
executable,
|
|
417
|
+
loaded: new Map(),
|
|
418
|
+
byInstallName: new Map(),
|
|
419
|
+
images,
|
|
420
|
+
}, slice, request.signal)));
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const reported = [...images.entries()]
|
|
424
|
+
.filter(([, facts]) => facts.status !== "not-mach-o")
|
|
425
|
+
.sort(([left], [right]) => compare(left, right));
|
|
426
|
+
const unparsed = reported
|
|
427
|
+
.filter(([, facts]) => facts.status !== "parsed")
|
|
428
|
+
.map(([path]) => path);
|
|
429
|
+
return {
|
|
430
|
+
roots,
|
|
431
|
+
images: reported.map(([path, facts]) => ({
|
|
432
|
+
path,
|
|
433
|
+
parse_status: facts.status === "not-mach-o" ? "unsupported" : facts.status,
|
|
434
|
+
reason: facts.status === "parsed" || facts.status === "not-mach-o"
|
|
435
|
+
? null
|
|
436
|
+
: facts.reason,
|
|
437
|
+
slices: facts.status === "parsed" ? facts.slices.map(withoutDependencies) : [],
|
|
438
|
+
})),
|
|
439
|
+
edges,
|
|
440
|
+
findings: deriveFindings(edges, roots, images),
|
|
441
|
+
coverage: {
|
|
442
|
+
status: unparsed.length === 0 &&
|
|
443
|
+
withoutArchitecture.length === 0 &&
|
|
444
|
+
environmentRoots.size === 0
|
|
445
|
+
? "complete"
|
|
446
|
+
: "partial",
|
|
447
|
+
unparsed_images: unparsed,
|
|
448
|
+
roots_without_architecture: withoutArchitecture,
|
|
449
|
+
},
|
|
450
|
+
limitations: [
|
|
451
|
+
...DYLIB_RESOLUTION_LIMITATIONS,
|
|
452
|
+
...(environmentRoots.size === 0
|
|
453
|
+
? []
|
|
454
|
+
: [
|
|
455
|
+
`Roots ${[...environmentRoots].join(", ")} request applicable image-selection inputs through LC_DYLD_ENVIRONMENT that are not modeled; affected dependencies or inserted images remain uncertain.`,
|
|
456
|
+
]),
|
|
457
|
+
],
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
const withoutDependencies = (slice) => ({
|
|
461
|
+
architecture: slice.architecture,
|
|
462
|
+
slice_offset: slice.slice_offset,
|
|
463
|
+
slice_size: slice.slice_size,
|
|
464
|
+
cpu_type: slice.cpu_type,
|
|
465
|
+
cpu_subtype: slice.cpu_subtype,
|
|
466
|
+
fat_cpu_type: slice.fat_cpu_type,
|
|
467
|
+
fat_cpu_subtype: slice.fat_cpu_subtype,
|
|
468
|
+
fat_alignment_exponent: slice.fat_alignment_exponent,
|
|
469
|
+
file_type: slice.file_type,
|
|
470
|
+
file_type_code: slice.file_type_code,
|
|
471
|
+
platform: slice.platform,
|
|
472
|
+
platforms: slice.platforms,
|
|
473
|
+
install_name: slice.install_name,
|
|
474
|
+
rpaths: slice.rpaths,
|
|
475
|
+
dyld_environment: slice.dyld_environment,
|
|
476
|
+
code_signature_present: slice.code_signature_present,
|
|
477
|
+
});
|
|
478
|
+
const compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const deriveFindings = (edges, roots, images) => {
|
|
2
|
+
const findings = [];
|
|
3
|
+
edges.forEach((edge, index) => {
|
|
4
|
+
if (edge.resolution.status === "unresolved")
|
|
5
|
+
findings.push(unresolvedFinding(edge, index));
|
|
6
|
+
const resolvedAt = edge.candidates.findIndex(({ outcome }) => outcome === "resolved");
|
|
7
|
+
const earlier = edge.candidates
|
|
8
|
+
.slice(0, Math.max(resolvedAt, 0))
|
|
9
|
+
.filter(({ source, outcome }) => source === "rpath" && outcome === "absent")
|
|
10
|
+
.map(({ path }) => path);
|
|
11
|
+
if (resolvedAt > 0 && earlier.length > 0)
|
|
12
|
+
findings.push({
|
|
13
|
+
kind: "earlier-rpath-candidate-absent",
|
|
14
|
+
edge_index: index,
|
|
15
|
+
image: edge.loader,
|
|
16
|
+
basis: "derived",
|
|
17
|
+
explanation: `The modeled dyld search checks ${earlier.join(", ")} before ${edge.resolution.image ?? edge.install_name}. A compatible Mach-O placed at an earlier modeled path could take precedence over that fallback, subject to unmodeled search inputs and code-signing library validation; library validation is not evaluated here (see inspect_signature).${edge.loader_conditional ? " This loader loads only conditionally; if it never loads, this search never occurs." : ""}${edge.resolution.status === "conditional" ? " Unmodeled environment overrides or earlier unknown candidates may take precedence; placing an image at this rpath does not establish which image dyld will load." : ""}`,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
for (const { image, architecture } of roots) {
|
|
21
|
+
const facts = images.get(image);
|
|
22
|
+
const slice = facts?.status === "parsed"
|
|
23
|
+
? facts.slices.find((candidate) => candidate.architecture === architecture)
|
|
24
|
+
: undefined;
|
|
25
|
+
const environment = slice?.dyld_environment ?? [];
|
|
26
|
+
if (environment.length > 0)
|
|
27
|
+
findings.push({
|
|
28
|
+
kind: "dyld-environment-present",
|
|
29
|
+
edge_index: null,
|
|
30
|
+
image,
|
|
31
|
+
basis: "derived",
|
|
32
|
+
explanation: slice?.file_type === "execute"
|
|
33
|
+
? `${image} (${architecture}) sets dyld environment variables through LC_DYLD_ENVIRONMENT (${environment.join(", ")}); any image-selection overrides they request are not modeled. Diagnostic settings alone do not alter resolution.`
|
|
34
|
+
: `${image} (${architecture}) contains LC_DYLD_ENVIRONMENT (${environment.join(", ")}). Dyld reads these commands only from the main executable; entries in this non-executable root are observations and do not alter resolution.`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return findings;
|
|
38
|
+
};
|
|
39
|
+
const unresolvedFinding = (edge, index) => {
|
|
40
|
+
const base = {
|
|
41
|
+
edge_index: index,
|
|
42
|
+
image: edge.loader,
|
|
43
|
+
basis: "derived",
|
|
44
|
+
};
|
|
45
|
+
const missing = `No candidate for ${edge.command === "LC_LAZY_LOAD_DYLIB" ? "lazily loaded " : edge.weak ? "weak dependency " : ""}${edge.install_name} exists in the analyzed root`;
|
|
46
|
+
// Below a conditional fallback, every consequence applies only if it loads.
|
|
47
|
+
const when = edge.loader_conditional
|
|
48
|
+
? `. ${edge.loader} loads only conditionally; if it loads, `
|
|
49
|
+
: "; ";
|
|
50
|
+
if (edge.command === "LC_LAZY_LOAD_DYLIB")
|
|
51
|
+
return {
|
|
52
|
+
...base,
|
|
53
|
+
kind: "lazy-load-unresolved",
|
|
54
|
+
explanation: `${missing}${when}dyld loads it on first use, which would fail unless the image is supplied elsewhere.`,
|
|
55
|
+
};
|
|
56
|
+
return edge.weak
|
|
57
|
+
? {
|
|
58
|
+
...base,
|
|
59
|
+
kind: "weak-load-unresolved",
|
|
60
|
+
explanation: `${missing}${when}dyld continues without it.`,
|
|
61
|
+
}
|
|
62
|
+
: {
|
|
63
|
+
...base,
|
|
64
|
+
kind: "required-load-unresolved",
|
|
65
|
+
explanation: `${missing}${when}dyld would fail to load this required dependency for ${edge.root} (${edge.architecture}) unless the image is supplied elsewhere.`,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export const DYLIB_RESOLUTION_LIMITATIONS = [
|
|
69
|
+
"LC_LAZY_LOAD_DYLIB dependencies are resolved but not traversed, because dyld loads them only on first use.",
|
|
70
|
+
"Slices are matched by dyld's graded architectures (an x86_64h process also loads x86_64). arm64e processes that disable pointer authentication can also load arm64 slices; that fallback is not modeled.",
|
|
71
|
+
"Absolute install names and rpaths are outside the analyzed root and are not evaluated, including /System and /usr/lib libraries that the dyld shared cache usually provides.",
|
|
72
|
+
"Leaf and relative install names depend on dyld fallback paths, DYLD_* variables, and the working directory; they are undetermined.",
|
|
73
|
+
"Load order follows dyld's dependents-first traversal in load-command order. An image reached through several chains is resolved once per process, with the rpath stack and conditionality of the first chain; a later request whose install name matches an already loaded image reuses it.",
|
|
74
|
+
"@loader_path uses each image's symlink-resolved path within the analyzed root.",
|
|
75
|
+
"Code-signing checks that can reject a found image, such as library validation and the hardened runtime, are not evaluated.",
|
|
76
|
+
"Dylib compatibility versions are not compared. Apple's linker documentation describes a load-time rejection when an image's compatibility version is older than the loader requires, but dyld on macOS 26 was observed to load such an image.",
|
|
77
|
+
];
|
|
@@ -28,6 +28,7 @@ export const buildInterfaceBuilderAnalysis = (input) => {
|
|
|
28
28
|
let omittedObjects = 0;
|
|
29
29
|
let omittedConnections = 0;
|
|
30
30
|
let omittedGraphNodes = 0;
|
|
31
|
+
let omittedHierarchyReferences = 0;
|
|
31
32
|
for (const document of input.documents.slice(0, input.limits.max_documents)) {
|
|
32
33
|
const parsed = parseInterfaceBuilderRecords(document.raw);
|
|
33
34
|
const prefix = `ib:${document.relativePath}:`;
|
|
@@ -276,6 +277,8 @@ export const buildInterfaceBuilderAnalysis = (input) => {
|
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
const objectsTruncated = parsed.omittedObjects > 0 || parsed.objects.length > documentObjectCount;
|
|
280
|
+
const parserOmittedHierarchyReferences = parsed.omittedHierarchyReferences;
|
|
281
|
+
omittedHierarchyReferences += parserOmittedHierarchyReferences;
|
|
279
282
|
const parserOmittedConnections = parsed.omittedConnections;
|
|
280
283
|
const connectionsTruncated = parserOmittedConnections > 0 ||
|
|
281
284
|
parsed.connections.length > input.limits.max_connections;
|
|
@@ -291,7 +294,9 @@ export const buildInterfaceBuilderAnalysis = (input) => {
|
|
|
291
294
|
document_kind: document.documentKind,
|
|
292
295
|
object_count: parsed.objectCount,
|
|
293
296
|
connection_count: parsed.connections.length + parserOmittedConnections,
|
|
294
|
-
hierarchy_complete: parsed.hierarchy.length > 0 &&
|
|
297
|
+
hierarchy_complete: parsed.hierarchy.length > 0 &&
|
|
298
|
+
!truncated &&
|
|
299
|
+
parserOmittedHierarchyReferences === 0,
|
|
295
300
|
});
|
|
296
301
|
coverage.push({
|
|
297
302
|
facet: `objects:${document.relativePath}`,
|
|
@@ -314,18 +319,22 @@ export const buildInterfaceBuilderAnalysis = (input) => {
|
|
|
314
319
|
parserOmittedConnections,
|
|
315
320
|
}, {
|
|
316
321
|
facet: `hierarchy:${document.relativePath}`,
|
|
317
|
-
status:
|
|
318
|
-
? "
|
|
319
|
-
:
|
|
320
|
-
? "
|
|
321
|
-
:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
status: parserOmittedHierarchyReferences > 0
|
|
323
|
+
? "partial"
|
|
324
|
+
: parsed.hierarchy.length === 0
|
|
325
|
+
? "unsupported"
|
|
326
|
+
: hierarchyTruncated || documentOmittedHierarchyEdges > 0
|
|
327
|
+
? "partial"
|
|
328
|
+
: "complete",
|
|
329
|
+
reason: parserOmittedHierarchyReferences > 0
|
|
330
|
+
? "archive_hierarchy_references_missing"
|
|
331
|
+
: parsed.hierarchy.length === 0
|
|
332
|
+
? "archive_hierarchy_not_decoded"
|
|
333
|
+
: hierarchyTruncated || documentOmittedHierarchyEdges > 0
|
|
334
|
+
? "graph_limit_reached"
|
|
335
|
+
: null,
|
|
327
336
|
examined: hierarchyCount,
|
|
328
|
-
omitted: documentOmittedHierarchyEdges,
|
|
337
|
+
omitted: documentOmittedHierarchyEdges + parserOmittedHierarchyReferences,
|
|
329
338
|
}, {
|
|
330
339
|
facet: `classes:${document.relativePath}`,
|
|
331
340
|
status: Object.keys(parsed.classes).length > 0 ? "complete" : "unsupported",
|
|
@@ -367,7 +376,10 @@ export const buildInterfaceBuilderAnalysis = (input) => {
|
|
|
367
376
|
nodes: [...nodes.values()],
|
|
368
377
|
edges,
|
|
369
378
|
coverage,
|
|
370
|
-
truncated: truncated ||
|
|
379
|
+
truncated: truncated ||
|
|
380
|
+
omittedObjects > 0 ||
|
|
381
|
+
omittedConnections > 0 ||
|
|
382
|
+
omittedHierarchyReferences > 0,
|
|
371
383
|
},
|
|
372
384
|
limitations: [
|
|
373
385
|
"The graph reflects recognized Interface Builder archive fields and connections; omitted private or unrecognized archive fields remain unknown.",
|