IoT malware analysis

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
In0de
April 30, 2020

IoT malware analysis

Introduce some ELF malware technical.

In0de

April 30, 2020

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

47 slides
  1. 台科資安社 /CNYCTG6GEJPKECN ▸ Run in memory ▸ ELF Infected ▸

    Anti-debug ▸ Anti-sandbox ▸ Packer ▸ ………
  2. 台科資安社 /CNYCTG6GEJPKECN ▸ Run in memory ▸ ELF Infected ▸

    Anti-debug ▸ Anti-sandbox ▸ Packer ▸ ……… #VVCEM &GHGPF
  3. 台科資安社 %QPVGPVU ▸ ELF Format ▸ Loader ▸ Run ELF

    in Memory ▸ Text Segment Infect ▸ PLT Infection ▸ Anti-debug
  4. 台科資安社 '.(6TCEKPI6QQNU ▸ Structure view: ELF Parser, readelf ▸ Static

    analysis: IDA pro, ghidra, objdump ▸ Dynamic analysis: GDB, ltrace, strace
  5. 台科資安社 %嵿峡罉幐篾纑 % 5 5QWTEGEQFG #UUGODN[EQFG %QORKNG KPENWFGUVFKQJ  KPVOCKP

    XQKF ] EJCT OUIň+ O*GNNQ9QTNFʼn RTKPVH U>POUI  TGVWTP _ OQXTDRTUR UWDTUR OQX3914&264=TDR?1((5'6(.#6.% OQXTCZ3914&264=TDR? OQXTFKTCZ ECNNRWVU OQXGCZ NGCXG
  6. 台科資安社 %嵿峡罉幐篾纑 5 1 #UUGODN[EQFG 1DLGEVEQFG #UUGODNG OQXTDRTUR UWDTUR OQX3914&264=TDR?1((5'6(.#6.%

    OQXTCZ3914&264=TDR? OQXTFKTCZ ECNNRWVU OQXGCZ NGCXG ELF Header Section [.text] Section Header Section [.rela.text] Section [.rodata] Section [.data] Section [.bss]
  7. 台科資安社 ELF Header Section [.text] Section Header Section [.rela.text] Section

    [.rodata] Section [.data] Section [.bss] Ŏ ň+ O*GNNQ9QTNFʼn %嵿峡罉幐篾纑 5 1 #UUGODN[EQFG 1DLGEVEQFG #UUGODNG
  8. 台科資安社 %嵿峡罉幐篾纑 1 GNH 1DLGEVEQFG 'ZGEWVCDNGEQFG .KPMGT ELF Header Program

    Header Section [.interp] Section Header Section [.rodata] Section [.strtab] Section [.symtab] Library Info Section [.dynsym] Section [.dynstr] Section [.text] ▸ Relocation ▸ Library Link ELF Header Section [.text] Section Header Section [.rela.text] Section [.rodata] Section [.data] Section [.bss]
  9. 台科資安社 '.((QTOCV ▸ ELF header ▸ Program header ▸ Section

    header ▸ Section ELF Header Program Header Section [.text] Section Header Section [.rodata] Section [.shstrtab] Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt]
  10. 台科資安社 4WP'.(KP/GOQT[ ▸ container.c & spy.c ▸ 偽裝 spy 執⾏的痕跡

    read(spy.elf) memfd = memfd_create(‘filename’,type) fork() execve(memfd, argv, env) Wait or leave write(memfd, spyBuf, size);
  11. 台科資安社 4WP'.(KP/GOQT[ ▸ xxd -i ./malware > malware_array ▸ 將malware_array

    放入程式 ELF Header Program Header Section [.text] Section Header Section [.rodata] Section [.shstrtab] Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt] Section [.data] spy.elf
  12. 台科資安社 5GEVKQPXU5GIOGPV ELF Header Program Header Section [.text] Section Header

    Section [.rodata] Section [.shstrtab] Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt] ELF Header Program Header Section [.text] Section [.rodata] Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt] 6GZVUGIOGPV 4GNQECVKQP UGIOGPV &CVC UGIOGPV Section Header
  13. 台科資安社 :A'.(.QCFKPI ELF Header Program Header Section [.text] Section [.rodata]

    Section [.plt] Section [.plt.got] Text Segment Relocation Segment Data Segment Heap Stack Align padding Z Z Z Z Z Section [.got] Section [.got.plt] Align padding Align padding
  14. 台科資安社 :A'.(.QCFKPI ELF Header Program Header Section [.text] Section [.rodata]

    Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt] Text Segment Relocation Segment Data Segment Heap Stack Align padding Align padding Align padding 2TQEGUU Section Header
  15. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] Section [.got] Section [.got.plt] Align padding Align padding Align padding Relocation Segment Data Segment Z Z Z Z Z Text Segment .CD6GUV5GIOGPV%QFG+PLGEVKQP
  16. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] 0x2000 ELF Header Program Header Section [.text] Section [.rodata] Section [.plt] Section [.plt.got] 5VGR Section [.got] Section [.got.plt] Section Header Section [.shstrtab] Section [.got] Section [.got.plt] Section Header Section [.shstrtab]
  17. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] 0x2000 5VGR㠚5GEVKQP*GCFGT QHHUGV QHHUGV Z Section [.got] Section [.got.plt] Section Header Section [.shstrtab]
  18. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] Section [.got] Section [.got.plt] 0x2000 Section Header Section [.shstrtab] 5VGR㠚2TQITCO*GCFGT 6GZVUGIOGPV 4GNQECVKQP UGIOGPV &CVC UGIOGPV
  19. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] 0x2000 5VGR㠚'.(*GCFGT GAUJQHH Z Section [.got] Section [.got.plt] Section Header Section [.shstrtab] GAGPVT[
  20. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] Section [.got] Section [.got.plt] 0x2000 Section Header Section [.shstrtab] 5VGR⬿5JGNNEQFG
  21. 台科資安社 ELF Header Program Header Section [.text] Section [.rodata] Section

    [.plt] Section [.plt.got] Section [.got] Section [.got.plt] 0x2000 Section Header Section [.shstrtab] 5VGR⦿GPVT[RQKPV OQXTCZTGCNAGPVT[ LORTCZ
  22. 台科資安社 椥藃獌'.(*GCFGT ELF Header (Elf64_Ehdr) WPUKIPGFEJCT GAKFGPV='+A0+&'06? 'NHA*CNH GAV[RG 

      1DLGEVHKNGV[RG  'NHA*CNH GAOCEJKPG   #TEJKVGEVWTG  'NHA9QTFGAXGTUKQP   1DLGEVHKNGXGTUKQP  'NHA#FFT GAGPVT[   'PVT[RQKPVXKTVWCNCFFTGUU  'NHA1HH GARJQHH   2TQITCOJGCFGTVCDNGHKNGQHHUGV  'NHA1HH GAUJQHH   5GEVKQPJGCFGTVCDNGHKNGQHHUGV  'NHA9QTFGAHNCIU   2TQEGUUQTURGEKHKEHNCIU  'NHA*CNH GAGJUK\G  '.(JGCFGTUK\GKPD[VGU  'NHA*CNH GARJGPVUK\G  2TQITCOJGCFGTVCDNGGPVT[UK\G  'NHA*CNH GARJPWO 2TQITCOJGCFGTVCDNGGPVT[EQWPV  'NHA*CNH GAUJGPVUK\G  5GEVKQPJGCFGTVCDNGGPVT[UK\G  'NHA*CNH GAUJPWO  5GEVKQPJGCFGTVCDNGGPVT[EQWPV  'NHA*CNH GAUJUVTPFZ  5GEVKQPJGCFGTUVTKPIVCDNGKPFGZ 
  23. 台科資安社 椥藃獌5GEVKQP*GCFGT 'NHA9QTFUJAPCOG  5GEVKQPPCOG UVTKPIVDNKPFGZ   'NHA9QTFUJAV[RG 

    5GEVKQPV[RG  'NHA:YQTF UJAHNCIU  5GEVKQPHNCIU  'NHA#FFT UJACFFT  5GEVKQPXKTVWCNCFFTCVGZGEWVKQP  'NHA1HH UJAQHHUGV   5GEVKQPHKNGQHHUGV  'NHA:YQTF UJAUK\G   5GEVKQPUK\GKPD[VGU  'NHA9QTFUJANKPM   .KPMVQCPQVJGTUGEVKQP  'NHA9QTFUJAKPHQ   #FFKVKQPCNUGEVKQPKPHQTOCVKQP  'NHA:YQTF UJACFFTCNKIP 5GEVKQPCNKIPOGPV  'NHA:YQTF UJAGPVUK\G  'PVT[UK\GKHUGEVKQPJQNFUVCDNG  Section Header 'NHA5JFT
  24. 台科資安社 椥藃獌2TQITCO*GCFGT 'NHA9QTFRAV[RG   5GIOGPVV[RG  'NHA9QTFRAHNCIU  

    5GIOGPVHNCIU  'NHA1HH RAQHHUGV  5GIOGPVHKNGQHHUGV  'NHA#FFT RAXCFFT  5GIOGPVXKTVWCNCFFTGUU  'NHA#FFT RARCFFT  5GIOGPVRJ[UKECNCFFTGUU  'NHA:YQTF RAHKNGU\   5GIOGPVUK\GKPHKNG  'NHA:YQTF RAOGOU\  5GIOGPVUK\GKPOGOQT[  'NHA:YQTF RACNKIP   5GIOGPVCNKIPOGPV  Program Header 'NHA2JFT
  25. 台科資安社 puts@plt LOR RWVU"IQVRNV RWUJZ LORZH PLT0 RWUJ )16 

     LOR )16  .text ECNNRWVU"RNV [email protected] RWVU"RNV  AFNATWPVKOGATGUQNXG NKPMAOCRAQDLTGNQEAKPFGZ 5JCTG.KDTCT[TWPVKOGDKPFKPI
  26. 台科資安社 .text ECNNRWVU"RNV puts@plt LOR RWVU"IQVRNV RWUJZ LORZH PLT0 RWUJ

    )16   LOR )16  dl_resolve %CNNHKZAWR [email protected] RWVUNKDECFFTGUU 5JCTG.KDTCT[TWPVKOGDKPFKPI
  27. 台科資安社 .CD2.65GEVKQP+PHGEVGF ELF Header Program Header Section [.text] Section [.rodata]

    Section [.plt] Section [.plt.got] Section [.got] Section [.got.plt] Section Header Section [.shstrtab] PLT0 RWUJ )16   LOR )16  puts@plt LOR RWVU"IQVRNV RWUJZ LORZH
  28. 台科資安社 .CD2.65GEVKQP+PHGEVGF PLT0 RWUJ )16   LOR )16 

    puts@plt LOR RWVU"IQVRNV RWUJZ LORUJGNNEQFG ELF Header Program Header Section [.text] Section [.rodata] Section [.plt] Section [.plt.got] 0x2000 Section [.got] Section [.got.plt] Section Header Section [.shstrtab] 獑獑獑
  29. 台科資安社 ㄙ屬CPVKFGDWI ▸ ptrace anti-debug ▸ /proc/self/status ▸ Clean section

    header ▸ https://github.com/JonathanSalwan/stuffz/blob/master/elf-corruption-little-anti-debug.c

More Decks by In0de

Other Decks in Education