Ejecuté el contenido del archivo php en bash, ¿podrían ejecutarse algunos comandos?

Ejecuté el contenido del archivo php en bash, ¿podrían ejecutarse algunos comandos?

Accidentalmente pegué esto en bash como superusuario en el servidor de producción.

Ahora estoy comiendo clavos.

Revisé cada línea y la mayoría produce un error de sintaxis. ¿Pero hay algo malo que podría dañar el sistema operativo del servidor? o archivos? ¿o algo?

Este es el servidor Ubuntu 14.04.

¿Cómo hago para diagnosticar qué comandos se ejecutaron y qué hicieron?

El historial es un lugar obvio, pero no muestra qué se ha ejecutado ni mediante qué programa. ¿Existe alguna forma de diagnosticar este tipo de estupidez?

<?php
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, WordPress Language, and ABSPATH. You can find more information
 * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
 * wp-config.php} Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '');

/** MySQL database username */
define('DB_USER', '');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'N%___i}IF<(o&h<;|_/0g-OYxEeU)Pq_JM@x!`S^-*[*$$#`|Lp|4R|');
define('SECURE_AUTH_KEY',  '.JyD{}94,kBQB`>&>)sT@4bMl|}SxJQ~ 1NUw^RdQ;QrLVC#].#64k');
define('LOGGED_IN_KEY',    '2ClY{7eA4933w3qEQ(L>o<{`WD|t-b4B<KW;psm6qa_Mmk.f~N1$]8');
define('NONCE_KEY',        ' $QAiTez.wIq_},tNekyQYgU3:;>y-[LT-vR8X{r+kuG-t!C>');
define('AUTH_SALT',        '!#0MnA@UTy]~CN#[Akn-2M<fEuGjSH,*Bu7B[!@@.owHb:G-_PXvP_');
define('SECURE_AUTH_SALT', '%DXWY0|+SkU%!aC.aXG#T{ |YZE|X.VyfVx8QW:bX+2sZ(7cw98i');
define('LOGGED_IN_SALT',   '{d}Pn%i>?B &Q@#Dw+*Xal^eD`xK4wet8=k+F9Tr2}2H75.@+{g+)');
define('NONCE_SALT',       ']3gOf&v-43GEe`hOqnu_1TwZeqU!ZIm-8}Lm1&0;pW7d`,4[QTT');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Respuesta1

Si esto sucedió en un directorio con archivos (no ocultos), entonces cualquier línea que comience con *se expandirá a una lista de archivos (no ocultos) en el directorio y, por lo tanto, intentará ejecutar el primero como un comando . . Si lo tiene .en su PATH, intentará ejecutarese archivo; si no es ejecutable, obtendrá un error. Si no lo tiene .en su PATH, intentará ejecutar un comando con ese nombre. Por ejemplo, en el improbable caso de que su directorio actual contenga los archivos

rm
romeo
sierra
tango

entonces el

* The base configurations of the WordPress.

El comando se expandirá como

rm romeo sierra tango The base configurations of the WordPress.

Espero que ya te hayas dado cuenta si eso hubiera sucedido (pero te aconsejo que hagas un análisis echo *para ver si el primer archivo es un comando válido).

Existe una preocupación similar para las líneas que comienzan /**, pero esto probablemente se expandirá a algo así como /bin /dev /etc /home /lib …, lo que resultará en

bash: /bin: is a directory

En el improbable caso de que tenga una variable de shell llamada table_prefix, entonces

$table_prefix  = 'wp_';

expandirá esa variable e intentará ejecutarla. Si table_prefixno está definido, lo anterior intentará ejecutarse =como un comando (y, que yo sepa, no existe tal comando en los sistemas Unix estándar).

Nada más me parece un problema.


1   A menos que haya algo más en la línea que lo convierta en un error de sintaxis, como un desequilibrado ).

información relacionada