Giter Club home page Giter Club logo

Comments (17)

rofl0r avatar rofl0r commented on July 22, 2024

maybe yet another issue due to stack size. what system is this ? please give detailed info like Ubuntu 14.14 x86_64

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

I had thought it would be something like that. I've tested it on the following:
Debian 8.0 x86_64 3.16.0-4
Ubuntu 16.04 x86_64 4.15.0-15

I did the following:
git clone https://github.com/rofl0r/microsocks
make
make install

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

try this, change line 416 from

size_t stacksz = MAX(8192, PTHREAD_STACK_MIN); /* 4KB for us, 4KB for libc */

to

size_t stacksz = 512 * 1024;

then run make and make install again

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

That fixed the issue! It builds and runs without issues now!! Thank you (:

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

great! would you be so kind as to try out some other sizes to find the "sweet spot" ?
maybe try with 256, 128, and maybe 64 KB.

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

Yea sure! You just want me to change the "512" in "512 * 1024" right? And keep going until segmentation fault happens again?

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

yes, exactly. thanks!

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

Just finished testing and found some new issues..

I tried between 8 and 512 (8, 16, 32, 64, 128, 256, 512) and they all worked. However, I've encountered a few new issue.

  1. User/Pass Auth always fails the first time, no matter what stack size I use. The second time always succeeds though.

  2. After it succeeds on the second attempt, it will never succeed again / keeps failing with incorrect user/pass until microsocks is restarted. If I launch with "-1" parameter, it will allow you to connect after successfully authing (on the second attempt) IF you have no auth set.

  3. If no Auth is set, everything works smoothly (:

Is this intended? If it is, is there a way I can get it to accept auth every time (and fix the possible first-attempt auth fail)? Thanks!

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

I tried between 8 and 512 (8, 16, 32, 64, 128, 256, 512) and they all worked.

that doesn't make sense. it probably means you tested the wrong binary (i.e. you were continuing to use the old one that worked, since changing the value from 8 to 512 fixed your issue originally.

User/Pass Auth always fails the first time, no matter what stack size I use. The second time always succeeds though.

what program are you doing the testing with ?

in my test:
terminal 1:

$ ./sockssrv.out -u user -P pass
client[5] 127.0.0.1: connected to xx.xx.xx.xx:80
client[4] 127.0.0.1: connected to xx.xx.xx.xx:80
client[5] 127.0.0.1: connected to xx.xx.xx.xx:80

terminal 2:

~ $ curl --socks5 user:pass@localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
~ $ curl --socks5 user:pass@localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
~ $ curl --socks5 user:pass@localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
~ $ curl --socks5 user:passX@localhost:1080 google.com
curl: (7) User was rejected by the SOCKS5 server (5 2).

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

I'm actually using a Windows Proxy Checker found here: https://www.proxifier.com/download/

I'm definitely removing/deleting the old binary and rebuilding it with a new make & make install. Perhaps I should just with curl on another linux box. I'll report back as soon as I can!

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

Alright after extensive testing: It seems the problem was with the proxy checker. Although this other I'm one using gives me: "Socks5 PROTOCOL ERROR", but we can just ignore that as it's exclusive to ProxyCap.

As for the stack size: 8 -> 512 works perfectly fine with:
size_t stacksz = 8 * 1024;

However, when I change it back to:
size_t stacksz = MAX(8192, PTHREAD_STACK_MIN);

I get segmentation fault.

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

huh. could you try putting this line after the MAX stuff ?

dprintf(2, "%zu\n", stacksz);

and tell me what it says ?

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

Sure!

With: size_t stacksz = MAX(8192, PTHREAD_STACK_MIN);
It prints: 16384

With: size_t stacksz = 8 * 1024;
It Prints: 8192

If I do: size_t stacksz = 16 * 1024;
It Prints: 16384 and gives Segmentation Fault

I think it's pretty safe to say that having a stackz size of 16384 is causing it to crash O:

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

With: size_t stacksz = MAX(8192, PTHREAD_STACK_MIN);
It prints: 16384

interesting. so now it works with the default ?

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

No no. It fails with the default. As long as the stackz size prints/is : 16384, it will give "Segmentation Fault".

So with: size_t stacksz = MAX(8192, PTHREAD_STACK_MIN);
It will Print: 16384 and give Segmentation Fault

With: size_t stacksz = 16 * 1024;
It will print: 16384 and give Segmentation Fault as well.

So anything that sets STACKZ to 16384 will give Segmentation fault (Including the default config/line).
And of course, just setting stacksz size to 8192 fixes it and all is well (:

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

...
that doesn't make sense. if it crashes, then it is due to too little stack.
so if it crashes with 16K, it should crash with 8K too...

from microsocks.

ryandotnet avatar ryandotnet commented on July 22, 2024

Hmm.. I'm not sure as to why it crashes either :/ But it only seems to crash at 16384. It doesn't crash at 8192 or 4096. I haven't tried lower though.

from microsocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.