Back to articles
Secure Ransomware Development 101 ~ How Do malware researchers break your ransomware via faulted compiler optimization

Secure Ransomware Development 101 ~ How Do malware researchers break your ransomware via faulted compiler optimization

via Dev.to7mo

so if you haven't seen part 1 you must go and check it out , so you can understand how does optimization influence code and what type of security issues does it bring to life . lets dive strait into a simple example of a text encryption that is flawed not by the code , but the compiler optimization . #include <stdio.h> #include <string.h> #include <stdlib.h> void _FALWEDcleanup ( char * ptr , size_t len ) { if ( ptr ) { memset ( ptr , 0 , len ); free ( ptr );}} void _CRYPTR ( char * data , const char * key ) { size_t inputLength = strlen ( data ); size_t keyLen = strlen ( key ); for ( size_t i = 0 ; i < inputLength ; i ++ ) { data [ i ] = data [ i ] ^ key [ i % keyLen ]; } } int main ( void ) { size_t bufferSize = 100 ; char * input = malloc ( bufferSize ); if ( input == NULL ) { return 1 ; } char * ourKEY = malloc ( 20 ); strcpy ( ourKEY , "i_love_you_000x" ); printf ( "enter some text to encrypt : " ); if ( fgets ( input , ( int ) bufferSize , stdin )) { input [ strcspn ( input , " \

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles