1

I recently started learning Haskell, and have been reading about many of the advantages it is supposed to offer over traditional imperative programming. I came across this post about reverse-engineering compiled Haskell code, and it made me wonder about malware written in Haskell.

  • Are there known instances of malware written in Haskell? (Quick Googling did not turn up any results for me.)
  • Does the complex nature of compiled Haskell programs make it an attractive choice as a malware development language?

My assumption is that the barriers of entry to learning Haskell are too high for rudimentary malware, and that those with the time/ability to learn it are writing more complex malware that requires the low-level features of a language like C. Is this known to be the case?

2

[Disclaimer: not my area of expertise]

Yeah, I would assume that haskell is too high-level.

Things malware wants to, in order of priority: accomplish your task, fool anti-virus scanners on the target, resist reverse engineering and analysis in a lab.

The complex nature of compiled Haskell probably helps with the third, but probably makes the first two harder. For example, the following are common malware tasks that are probably difficult to accomplish in Haskell:

  • insert itself into another application or document such that it is still executable (virus behaviour)
  • obfuscate / encrypt its own string constants to avoid easy scanning of the binary
  • re-write its own code dynamically to change its fingerprint and fool anti-viruses
  • other evasion techniques
  • use and manipulate dlls it finds on the target machine
  • read / modify memory belonging to other processes
  • read / modify system data such as the master boot record

If you're at the level of sophistication where you're worried about reverse-engineering, I can't imagine that any compiled language is very attractive - you probably spend at least half your time working directly with assembly.

  • 1
    Another - maybe more simple - reason is, that there is a lot of malware out there and a lot of malware developers. A lot of these developers aren't necessarily highly trained or well-educated programmers, so they use the language they are good at. Haskell is (from my experience) a pretty niche language and therefore not a lot of people are skilled enough, to assemble the kind of malware they want with Haskell. – Tom K. Aug 4 '17 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.