Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Vulnerability Development: Problem with keyboard forwarding to cmd.exe shellcode

Problem with keyboard forwarding to cmd.exe shellcode

From: Berend-Jan Wever <skylined_at_edup.tudelft.nl>
Date: Tue, 14 Sep 2004 12:46:01 +0200

Hi guys,

I'm working on a "shellcode client" that'll forward I/O to a cmd.exe shellcode on a remote computer. I ran into two problems:
- To forward ^C and ^Z, I'm catching interrupt and terminal stop signals and send a 0x03 or 0x1A respectively. This doesn't seem to work: if you'd type "copy con file.txt", you're doomed because neither the ^C nor the ^Z will break the command.
- Turning off buffering on stdin doesn't work like I would expect it to, does anybody know how to do this properly ? (see the code below)
babyjee_at_papa:~/prg/tools/w32_cmdftp$ ./test
abc
[61][62][63][0a]
babyjee_at_papa:~/prg/tools/w32_cmdftp$

---start test.c---
#include <stdio.h>
#include <stdlib.h>

int main() {
  int byte;

  if (setvbuf(stdin, NULL, _IONBF, 0) != 0) {
    perror("Cannot remove buffering from stdin");
    exit(EXIT_FAILURE);
  }

  do {
    fprintf(stdout, "[%02x]", byte=getchar());
    fflush(stdout);
  } while (byte != '\n');

  fprintf(stdout, "\n");
  exit(EXIT_SUCCESS);
}

---end test.c---
Received on Sep 19 2004

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos