michaelweber / Macrome

Excel Macro Document Reader/Writer for Red Teamers & Analysts
MIT License
513 stars 78 forks source link

Formula too long #11

Closed OfficialRepositories closed 3 years ago

OfficialRepositories commented 3 years ago

Macro provided by Excelntdonut using -- obfuscate on excelntdonut, says formula is too long maximum character 255

ShanonKing commented 3 years ago

Hello @michaelweber first of all thanks for this amazing tool! Im a infosec student and im playing around with this tool but im facing the same error as this user i will import the error

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Imported Cell Formula is too long - length must be 255 or less: ?[??5?&?_??#?????+?~??a(???>y????J A??I??? mUg????e/?~?.??[?9e?I? ??V? ???J^?????S?'?I????'?fc?u??1z???g???L??2??"??n?T???.??W?z!???I???d???QÖ?z???x??u??????3|??x?X???????!?m???'{???52?D???'aqj2dM?#???z&???¼??xViNroX?m+?d?x?44[?XTr?N?!?I??*<?f?Q?V"??g???4"2???A???~D?n}M?^???V??????>U??[?(st?F?[??"? at Macrome.MacroPatterns.ImportCellFormula(String cellFormula) in C:\Users\Weber\source\repos\michaelweber\Macrome\MacroPatterns.cs:line 214 at System.Linq.Enumerable.SelectListIterator2.MoveNext() at System.String.Join(String separator, IEnumerable1 values) at Macrome.MacroPatterns.ImportMacroPattern(List`1 macrosToImport) in C:\Users\Weber\source\repos\michaelweber\Macrome\MacroPatterns.cs:line 252 at Macrome.Program.Build(FileInfo decoyDocument, FileInfo payload, FileInfo payload64Bit, String preamble, PayloadType payloadType, String macroSheetName, String outputFileName, Boolean debugMode, SheetPackingMethod method, String password) in C:\Users\Weber\source\repos\michaelweber\Macrome\Program.cs:line 219 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.CommandLine.Invocation.ModelBindingCommandHandler.d8.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 System.CommandLine.Invocation.InvocationPipeline.<>cDisplayClass4_0.<b0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b20_0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass15_0.<b0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass24_0.<b0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass22_0.<b0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b21_0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b19_0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b11_0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__10_0>d.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 System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass13_0.<b__0>d.MoveNext()

michaelweber commented 3 years ago

Hey folks - if you're directly embedding Donut files try now with the new version out at https://github.com/michaelweber/Macrome/releases/tag/v0.4.1. Make sure you use the new argument --payload-method base64 - this is a MUCH more stable way to embed payloads, it might fix issues folks are having here.

The base64 encoding mechanism doesn't try manually writing the content 255 bytes at a time from =CHAR() formulas and this is where the majority of the stability issues have been coming from.

michaelweber commented 3 years ago

Closing this out since it's been a while and the issue is likely fixed.