Coder Social home page Coder Social logo

Comments (4)

HsuJv avatar HsuJv commented on June 6, 2024

Hi,

May I have a copy of your PoC code?

It looks strange cuz this assert is only to test the first 4 bytes of the ssh server replies when we connected.
According to the RFC, it must be "SSH-xxxxxx", which in ASCII is [83, 83, 72, 45, xxxxx]

A fatal here is that we shall throw an error rather than panic. But if you're connecting a true ssh server, it is worth investigating more about how could it happen.

BRs.

from ssh-rs.

Paulo-21 avatar Paulo-21 commented on June 6, 2024

Hi, thank you for your help.
Ssh Server : OpenSSH_8.9p1

PoC

use ssh;
use std::thread::{self, JoinHandle};
use std::thread::available_parallelism;
fn main() {
    //let default_parallelism_approx = available_parallelism().unwrap().get();
    let default_parallelism_approx = 11;
    let mut threads = Vec::<JoinHandle<()>>::new();
    for i in 0..default_parallelism_approx {
        let mut start = i;
        let e = thread::spawn(move || {
            let session_name = "Admin";
	    let password = "12345678";
            while start < 10000 {
                let connection = ssh::create_session()
                .username(&session_name)
                .password(&password)
                .connect("wwww.website.com:22");

        }
        });
        threads.push(e);
    }
    for _u in 0..default_parallelism_approx {
        let r = threads.pop().unwrap();
        let _ = r.join();
    }
}

from ssh-rs.

HsuJv avatar HsuJv commented on June 6, 2024

Hi @Paulo-21

With #78 it now returns an error SshError::VersionDismatchError rather than panic.

It's actually some error message which indicates that the server is not able to handle more clients.

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: VersionDismatchError { our: "SSH-2.0-SSH_RS-0.4.1", their: "Exceeded MaxStartups" }', exec/src/main.rs:38:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: VersionDismatchError { our: "SSH-2.0-SSH_RS-0.4.1", their: "Exceeded MaxStartups" }', exec/src/main.rs:38:18
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: VersionDismatchError { our: "SSH-2.0-SSH_RS-0.4.1", their: "Exceeded MaxStartups" }', exec/src/main.rs:38:18
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: VersionDismatchError { our: "SSH-2.0-SSH_RS-0.4.1", their: "Exceeded MaxStartups" }', exec/src/main.rs:38:18

I'll later have 0.4.2 released to include the fix.

Thank you for reporting!

BRs.

from ssh-rs.

Paulo-21 avatar Paulo-21 commented on June 6, 2024

Hi @HsuJv
Thank you for your reactivity.

from ssh-rs.

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.