Author Topic: [C] Reverse Connection  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
[C] Reverse Connection
« on: March 22, 2014, 03:39:11 am »
I just learn about reverse connection and try to implement it yesterday using C. It works correctly when I am using my local IP address to connect. But when I am using public IP address it didn't get accepted on my server. I have done port forwarding on my router. I have also try to connect with my modem. My OS is OSX Mavericks and I use tp-link router. Is there something I miss? Do i need to assign 80 to my port? Sorry i am kinda new to networking.

This is my code.
http://ideone.com/IeJR3a
« Last Edit: March 22, 2014, 07:24:25 am by Hermit »

Offline NHAS

  • Serf
  • *
  • Posts: 40
  • Cookies: 1
    • View Profile
Re: [C] Reverse Connection
« Reply #1 on: March 22, 2014, 07:51:54 am »
So I take it the server is the program? or is it something else...

Anyway:
Well I tried to do this with a small C++ program I wrote not so long ago.
It didn't work for me ether and talking out of ignorance
I think some ISP's (internet service providers) don't let some kinds on incoming connections to the router even if you have specified that it should be allowed.

So in short, I think your code looks fine its most likely your isp stopping the connection

Oh and if I have this wrong please correct me.


Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
Re: [C] Reverse Connection
« Reply #2 on: March 22, 2014, 08:06:12 am »
Well i am trying to create a simple RAT with reverse connection. I read that the victim computer act as the client and the attacker computer act as the server. I have implement the client. It run well if the computer is on the same LAN. But when i try to run it on my friend's computer with public IP address,it didn't connect. I have also tried to use telnet and still didn't work. Anyway, thanks for your reply and sorry for my poor English
« Last Edit: March 22, 2014, 08:07:44 am by Hermit »

Offline NHAS

  • Serf
  • *
  • Posts: 40
  • Cookies: 1
    • View Profile
Re: [C] Reverse Connection
« Reply #3 on: March 22, 2014, 08:33:18 am »
The fact that you're starting attempt at a RAT works over local network further supports my idea.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [C] Reverse Connection
« Reply #4 on: March 22, 2014, 09:14:20 am »
Why not make it connect to a webserver instead where it sends data to and receives commands from, would be easier than connecting straight to your computer, not to mention not secure. I had this rant on another thread here: https://evilzone.org/c-c/%28discussion%29-rat-programming-basics/

Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
Re: [C] Reverse Connection
« Reply #5 on: March 22, 2014, 10:09:57 am »
@Kulverstukas I didn't really get it. Is there any free web server out there? . Do you mean using service like http://www.000webhost.com/. Sorry if it a noob question. hehe
« Last Edit: March 22, 2014, 10:18:54 am by Hermit »

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [C] Reverse Connection
« Reply #6 on: March 22, 2014, 10:20:59 am »
"sorry me noob" is not an excuse for acting stupid. Search before asking. We had discussions about free webhosts, one of them being: https://evilzone.org/general-discussion/free-web-hosting-support-php-50gb-space/

Also you can just pay for one, free webhosts are complete shit. Just spend a few $ and you'll get a reliable host.

Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
Re: [C] Reverse Connection
« Reply #7 on: March 22, 2014, 10:33:20 am »
@Kulverstukas Okay thanks for your advice. Next time I will do it.

Offline kenjoe41

  • Symphorophiliac Programmer
  • Administrator
  • Baron
  • *
  • Posts: 990
  • Cookies: 224
    • View Profile
Re: [C] Reverse Connection
« Reply #8 on: March 22, 2014, 01:45:35 pm »
But is your problem solved? You are kneeling cos an Admin spoke but i don't think you have the solution yet, i mean you practise with localhost till the code is good then you deploy it. Anyway, i don't know your network design but i hope their aint any NAT in between that might filter your traffic. I haven't looked at your code to be honest since you didn't post it here (i wonder why, am on my phone) so am not sure if this is the problem but consider everything anyway.
If you can't explain it to a 6 year old, you don't understand it yourself.
http://upload.alpha.evilzone.org/index.php?page=img&img=GwkGGneGR7Pl222zVGmNTjerkhkYNGtBuiYXkpyNv4ScOAWQu0-Y8[<NgGw/hsq]>EvbQrOrousk[/img]

Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
Re: [C] Reverse Connection
« Reply #9 on: March 22, 2014, 02:21:39 pm »
@kenjoe. I don't think it is because of NAT because i have done port forwarding. I also have tried not to use my router to connect to the Internet but instead use modem. I have posted my code at the link above(ideone) . The application is not finished yet, I just try the connection by sending "Hello" to the client. Well now, i am trying to learn using external web server. It is good knowing something new.

EDIT:
The fact that you're starting attempt at a RAT works over local network further supports my idea.

I checked if there are any open port at www.grc.com and all my port ranging from 1 to 1056 are stealth. I guess my ISP blocks all the port.

-- Double posters get slapped! Use the modify button fool.
« Last Edit: March 24, 2014, 09:34:47 pm by lucid »

Offline ZeroBoy

  • /dev/null
  • *
  • Posts: 14
  • Cookies: 0
    • View Profile
    • Python for Pentesting @OffensivePython
Re: [C] Reverse Connection
« Reply #10 on: April 01, 2014, 05:22:21 am »
I don't recommend C&C based RATs  if you want to start one from scratch, because you have to write your own C&C script (you might learn php). even if you willing to use a ready-made one, you MUST customize your rat to be compatible with that script which is pretty much pain in the ass. plus, anyone have your server, can easily inject malicious data in the server you're hosting your C&C Panel

most people using ready-made C&C rats, so they would always recommend newcomers to code a C&C based rats, while they don't realise how time consuming it is.

I would say that C&C based RATs is more suitable for mass infections...
====
Have you forwarded 52142 and test it here and it says opened?
« Last Edit: April 01, 2014, 05:31:15 am by ZeroBoy »

Offline Hermit

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 0
    • View Profile
Re: [C] Reverse Connection
« Reply #11 on: April 02, 2014, 02:17:09 pm »
@ZeroBoy I have just changed my ISP(I try four different ISP actually before succeeded), and now it can connect to my server via public ip address. Later i will try to forward that port from my previous ISP and report the result. Thanks for your advice.