decalage2 / ViperMonkey

A VBA parser and emulation engine to analyze malicious macros.
1.04k stars 185 forks source link

Rnd Function Fix #118

Open malvidin opened 2 years ago

malvidin commented 2 years ago

The Rnd function does not return 71 if Randomize is not called.

Steps to reproduce the behavior: Execute script:

intHighNumber = 100
intLowNumber = 1

intNumber = Int((intHighNumber – intLowNumber + 1) * Rnd + intLowNumber)
Wscript.Echo intNumber

71 should be returned, unless Randomize is called before Rnd.

https://devblogs.microsoft.com/scripting/how-can-i-generate-random-numbers-using-a-script/