Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wpscan --update renders error after upgrade from Ubuntu 20.04 to Ubuntu 22.04. /usr/bin/ruby2.7: bad interpreter: No such file or directory #1835

Open
Danrancan opened this issue Mar 20, 2024 · 4 comments

Comments

@Danrancan
Copy link

Danrancan commented Mar 20, 2024

Subject of the issue

I just upgraded from Ubuntu Server 20.04 to Ubuntu Server 22.04.
After the upgrade I tried updating my wpscan version with wpscan --update but it gives me the following errors:

wpscan --update
bash: /usr/local/bin/wpscan: /usr/bin/ruby2.7: bad interpreter: No such file or directory

wpscan -v does the same thing:

wpscan -v
bash: /usr/local/bin/wpscan: /usr/bin/ruby2.7: bad interpreter: No such file or directory

Your environment

  • Version of WPScan: Latest version from Ubuntu 20.04, otherwise unkown because wpscan -v doesn't work.
  • Version of Ruby: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [aarch64-linux-gnu]
  • Operating System (OS): Ubuntu Server 22.04.4 LTS (Jammy Jellyfish)

Steps to reproduce

Just upgrade from Ubuntu 20.04 to Ubuntu 22.04. Then run wpscan --update or wpscan -v.

Expected behavior

if wpscan --update, then wpscan should update itself properly, or if running wpscan -v, it should show it's version.

Actual behavior

wpscan -v
bash: /usr/local/bin/wpscan: /usr/bin/ruby2.7: bad interpreter: No such file or directory
wpscan --update
bash: /usr/local/bin/wpscan: /usr/bin/ruby2.7: bad interpreter: No such file or directory

What have you already tried

I havent tried anything. I just wanted to report the issue right away so that I didn't make any mistakes fixing it by myself. Hopefully I get some fixes from this post.

  • Update WPScan to the latest version [ Can't do that]
  • Update Ruby to the latest version [YES: ruby/jammy,now 1:3.0~exp1, ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [aarch64-linux-gnu]]
  • Ensure you can reach the target site using cURL [ Dont know what this means]
  • Proxied WPScan through a HTTP proxy to view the raw traffic [ No, Don't know how to do this]
  • Ensure you are using a supported Operating System (Linux and macOS) [Fairly certain Ubuntu 22.04 is supported ]

What can I do to fix this?

Answers needed....

@Danrancan
Copy link
Author

Now it's working. I'm not positive becuse I for document the solution to this issue, but if my memory is correct, I just downloaded Ruby again. Now I have ruby 2.0.2p107, and things are working. I think during my Ubuntu 20 upgrade to Ubuntu 2204, The upgrade removed th ruby 2.7 packages as I think it's deprecated with Ubuntu 22.04. So basically, If I remember correctly, I just installed a modern version of Ruby in Ubuntu 22.04, and this error went away. Everything seems to be working correctly again. Maybe this post will help others.

Thanks.
Dan

@AjarnSpencer
Copy link

AjarnSpencer commented Jul 26, 2024

Installing WPScan on Ubuntu hassle-free way;

(don't worry if you already installed it it will adapt and change according to needs, otherwise remove it and begin from scratch)

###Open your terminal (anywhere)

Run the following command;

sudo gem install wpscan

You might be prompted for your password.

Running WPScan

Once installed, you can run WPScan from any directory with:
Open terminal, type this and press enter;
wpscan --url thewordpress-site-you-want-to-scan.com

e.g.

wpscan --url hackme.com

if you get a fail as many sites use https these days you use this
wpscan --url somewordpressblog.com --ignore-main-redirects

that worked for me after installing ruby, python and pip and the build dependencies in python first
Hope this helps someone or other with the same setup


     \ \        / /  __ \ / ____|
      \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
       \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
        \  /\  /  | |     ____) | (__| (_| | | | |
         \/  \/   |_|    |_____/ \___|\__,_|_| |_|

     WordPress Security Scanner by the WPScan Team
                     Version 3.8.25
                           
   @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart

[i] Updating the Database ...
[i] Update completed.

@Archurcl4w
Copy link

Archurcl4w commented Aug 31, 2024

Hello, I had the following errors when running every time wpscan in the Kali Linux 2024.2, 6.8.11-amd64 after upgrading. The version of wpscan is 3.8.25.

/usr/local/bin/wpscan: bad interpreter: /usr/bin/ruby3.0: no such file or directory

It means that the script /usr/local/bin/wpscan has an incorrect shebang line. In this case, it seems the shebang is incorrectly pointing to /usr/bin/ruby3.0, which doesn't exist. Thus, the fix is provided as
Check the Shebang Line :

sudo nano /usr/local/bin/wpscan

I found it's wrongly pointing as expected :-

#!/usr/bin/ruby3.0

I am changing it to :-

#!/usr/bin/ruby

Then I ensure the script is executable and it's fixed.

sudo chmod +x /usr/local/bin/wpscan

@Danrancan
Copy link
Author

Running WPScan

Once installed, you can run WPScan from any directory with: Open terminal, type this and press enter; wpscan --url thewordpress-site-you-want-to-scan.com

e.g.

wpscan --url hackme.com

Correction:

$ wpscan --url mysite.com --ignore-main-redirects

Scan Aborted: invalid option: --ignore-main-redirects
Did you mean?  ignore-main-redirect

Should be:

$ wpscan --url mysite.com ignore-main-redirects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants