Skip to content

Rubeus processing failure with "Unhandled Exception: System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> " #3

@sdvm0234vnj034evnjw

Description

@sdvm0234vnj034evnjw

Codeception build was successful and appears to run properly.
Verified Rubeus build was successful.

Used the following build command:
codeception.exe --action obfuscate --module csharp --verbose --path "C:\Users\user\C\Tools\Rubeus_Obfuscation_Project\Rubeus\Rubeus.sln" --map-file "C:\Users\user\C\Tools\Rubeus_Obfuscation_Project" --profile rubeus --rename fp --rename-method markov --markov-min-length 3 --markov-max-length 9 --markov-min-words 3 --markov-max-words 4 --string-rewrite --string-rewrite-method single

Also tried this command:
codeception.exe --action obfuscate --module csharp --verbose --path "C:\Users\user\C\Tools\Rubeus_Obfuscation_Project\Rubeus\Rubeus.sln" --map-file "C:\Users\user\C\Tools\Rubeus_Obfuscation_Project" --profile rubeus --rename all --rename-method markov --markov-min-length 3 --markov-max-length 9 --markov-min-words 3 --markov-max-words 4 --string-rewrite --string-rewrite-method single

Both resulted in the following error output (the top section before the error was different for each command because of the different renaming parameters; but the error output was the same):

[22:31:24] Codecepticon v1.2.3 is starting...
[22:31:24] Training Markov Generator...
[22:31:28] Getting Visual Studio Instance
[22:31:28]
[22:31:28] Multiple installs of MSBuild detected, please select one:
[22:31:28]
[22:31:28]      [1]     Visual Studio Community 2022 v17.14.37012.4
[22:31:28]              C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin
[22:31:28]      [2]     Visual Studio Community 2026 v18.2.11415.280
[22:31:28]              C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin
[22:31:28]
[22:31:28] Please enter the number of your selection: 1
[22:31:31] Creating MSBuild Workspace
[22:31:31] Loading solution: C:\Users\user\C\Tools\Rubeus_Obfuscation_Project\Rubeus\Rubeus.sln
[22:31:33] Finished loading solution
[22:31:33]
[22:31:33] Processing project C:\Users\user\C\Tools\Rubeus_Obfuscation_Project\Rubeus\Rubeus\Rubeus.csproj
[22:31:35]
[22:31:35] Elements Found:
[22:31:35]      Namespaces:     19
[22:31:35]      Classes:        156
[22:31:35]      Enums:          631
[22:31:35]      Functions:      567
[22:31:35]      Properties:     192
[22:31:35]      Parameters:     633
[22:31:35]      Variables:      1539
[22:31:35]      Structs:        89
[22:31:35] Generating mappings...
[22:31:35] Creating mappings for functions
[22:31:35] Creating mappings for properties
[22:31:35] Rewriting code...
[22:31:35] Selected profile is: Rubeus
[22:31:35] Running profile-specific pre-process actions...
[22:31:35] Rewriting assemblies..................
[22:31:35] Removing comments..................
[22:31:36] Rewriting switch statements..................
[22:31:36] Rewriting strings..................
[22:31:36] Renaming 567 functions..................
[22:32:12] Renaming 192 properties..................

Unhandled Exception: System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
   at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at Microsoft.Build.Shared.FileMatcher.<RemoveProjectDirectory>d__37.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Build.Shared.FileMatcher.GetFilesForStep(RecursiveStepResult stepResult, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory)
   at Microsoft.Build.Shared.FileMatcher.GetFilesRecursive(ConcurrentStack`1 listOfFiles, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory, IList`1 searchesToExclude, Dictionary`2 searchesToExcludeInSubdirs, TaskOptions taskOptions)
   at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Shared.FileMatcher.<>c__DisplayClass67_0.<GetFiles>b__1(String _)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileList(String directoryEscaped, String filespecEscaped, Boolean returnEscaped, Boolean forceEvaluateWildCards, IEnumerable`1 excludeSpecsEscaped, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.IncludeOperation.SelectItems(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.ApplyImpl(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.Apply(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.ComputeItems(LazyItemList lazyItemList, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetItemData(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetMatchedItems(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.EvaluatorData.GetItems(String itemType)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCapture[S](Expander`2 expander, ItemExpressionCapture expressionCapture, IItemProvider`1 evaluatedItems, IElementLocation elementLocation, ExpanderOptions options, Boolean includeNullEntries, Boolean& isTransformExpression, List`1& itemsFromCapture)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCaptureIntoItems[S,T](ItemExpressionCapture expressionCapture, Expander`2 expander, IItemProvider`1 items, IItemFactory`2 itemFactory, ExpanderOptions options, Boolean includeNullEntries, Boolean& isTransformExpression, IElementLocation elementLocation)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.IncludeOperation.SelectItems(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.ApplyImpl(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.Apply(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.ComputeItems(LazyItemList lazyItemList, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetItemData(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetMatchedItems(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.EvaluatorData.GetItems(String itemType)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCapture[S](Expander`2 expander, ItemExpressionCapture expressionCapture, IItemProvider`1 evaluatedItems, IElementLocation elementLocation, ExpanderOptions options, Boolean includeNullEntries, Boolean& isTransformExpression, List`1& itemsFromCapture)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCaptureIntoItems[S,T](ItemExpressionCapture expressionCapture, Expander`2 expander, IItemProvider`1 items, IItemFactory`2 itemFactory, ExpanderOptions options, Boolean includeNullEntries, Boolean& isTransformExpression, IElementLocation elementLocation)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.IncludeOperation.SelectItems(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.ApplyImpl(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.Apply(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.ComputeItems(LazyItemList lazyItemList, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetItemData(ImmutableHashSet`1 globsToIgnore)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ICollection`1 propertiesFromCommandLine, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, IDirectoryCacheFactory directoryCacheFactory, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, Boolean interactive)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at Codecepticon.Modules.CSharp.VisualStudioManager.GetBuildProject(Project project)
   at Codecepticon.Modules.CSharp.VisualStudioManager.SetConfiguration(Solution solution, Dictionary`2 properties, Boolean isGlobal)
   at Codecepticon.Modules.CSharp.CSharpManager.<RewriteCode>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Codecepticon.Modules.CSharp.CSharpManager.<Obfuscate>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Codecepticon.Modules.CSharp.CSharpManager.<Run>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Codecepticon.Program.<Main>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Codecepticon.Program.<Main>(String[] args)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions