0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Officeファイルを通じたマクロの実行

Posted at

はじめに

マルウェア解析の勉強の一環としてword文書を通じたマクロの実行について勉強しました。
随時更新予定です。

免責事項

詳細は存じ上げませんが、マルウェア等のコンピュータウイルスおよびその製法を不特定多数に配布することや不特定多数がアクセスできる場所に置くことは法律で禁止されているそうです。この記事は直接的なマルウェアの製法を掲載しているわけではないので大丈夫だとは思いますが...

※この記事が原因で生じた損害について、著者は責任を負いかねますのでご注意ください。

マクロの準備

Wordファイルの場合、開発 → Visual Basic でマクロ編集画面に行けます。

マクロ簡易まとめ

特定のOfficeファイルを開く

Sub openDoc()
    Documents.Open FileName:=".\path\to\the\officefile.docx", ReadOnly:=True
End Sub

.\path\to\the\officefile.docxファイルがが開かれます。

Officeファイルを開いたときに特定のコードを実行する

Private Sub Document_Open()
    runCode
End Sub

runCode()メソッドが実行されます。

実践

あるOfficeファイルを開いたら別のOfficeファイルが勝手に開かれる

マクロ編集画面に進み、Prpject\Microsoft Word Objects\ThisDocument に以下を記入。

Private Sub Document_Open()
    openDoc
End Sub

Sub openDoc()
    Documents.Open FileName:=".\path\to\the\poo.docx", ReadOnly:=True
End Sub

hello.docmを開いたらpoo.docxが勝手に開かれる。例えばpoo.docxをマルウェア実行ファイルに置き換えて実行した場合、コンピュータにウイルスがばらまかれてしまう。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?