关于rsync rsync(remote synchronize)Linux下实现远程同步功能的软件,能同步更新两处计算机的文件及目录。在同步文件时,可以保持源文件的权限、时间、软硬链接等附加信息。常被用于在内网进行源代码的分发及同步更新,因此使用人群多为开发人员;而开发人
关于rsync
rsync(remote synchronize)——Linux下实现远程同步功能的软件,能同步更新两处计算机的文件及目录。在同步文件时,可以保持源文件的权限、时间、软硬链接等附加信息。常被用于在内网进行源代码的分发及同步更新,因此使用人群多为开发人员;而开发人员安全意识薄弱、安全技能欠缺往往是导致rsync出现相关漏洞的根源。
rsync默认配置文件为/etc/rsyncd.conf,常驻模式启动命令rsync –daemon,启动成功后默认监听于TCP端口873,可通过rsync-daemon及ssh两种方式进行认证。
常用操作
列举整个同步目录或指定目录:
1 2 |
rsync 10.0.0.12:: rsync 10.0.0.12::www/ |
下载文件或目录到本地:
1 2 |
rsync -avz 10.0.0.12::www/test.php /root rsync -avz 10.0.0.12::www/ /var/tmp |
上传本地文件到服务端:
1 |
rsync -avz webshell.php 10.0.0.12::www/ |
端口修改
在其配置文件中不存在监听端口修改相关选项,但可在启动命令行通过参数–port进行指定
因此通过进程查看方式,可以直接获得其真实监听端口。
通过端口扫描也可自动判断出其服务名及版本信息。
客户端在连接时,也需指定相应端口号,否则会出现端口拒绝连接错误提示。
认证方式
rsync默认允许匿名访问,也可在其配置文件中为同步目录添加用户认证相关项,包括认证文件及授权账号,若未包含授权账号行(auth users),则为匿名访问。
其用户认证文件内容为明文保存,但该文件权限必须设置为600,普通用户并无读取权限。
若认证文件权限设置错误,客户端用户即使口令输入正确,也会出现认证失败的提示信息。
此外由于rsync还支持ssh协议,因此可通过系统用户进行认证,即在rsync上通过SSH隧道进行传输,类似于scp工具,此时同步操作不再局限于rsync中定义的同步文件夹。
若服务端SSH为非标准端口,可通过rsync的-e参数进行端口指定。
本地提权
由于rsync进程默认以root权限启动,在rsync为匿名访问或存在弱口令前提下,还可利用其在同步文件过程中保持源文件权限的特性,进行本地权限提升。
在本地将bash shell添加suid权限位,并通过rsync上传到服务端。
在有普通用户shell权限前提下(通过rsync上传webshell或其他弱口令等漏洞),切换到同步目录,查看上传的shell文件权限不变,运行后即可提升为root权限。
自动化脚本
Metasploit中关于允许匿名访问的rsync扫描模块:auxiliary/scanner/rsync/modules_list
nmap中针对rsync同步目录列举的脚本rsync-list-modules:https://svn.nmap.org/nmap/scripts/rsync-list-modules.nse,似乎用处并不大。
另一个针对rsync口令暴力破解的脚本rsync-brute :https://svn.nmap.org/nmap/scripts/rsync-brute.nse。
91ri.org:我们附一个rsync(rssh)远程溢出的东西,虽然有点老,但是在内网环境中也是有遇到的几率,万一就中了呢。。
rssh 2.3.3-3在使用rsync时没有正确过滤 -e 选项,可导致远程攻击者利用此漏洞执行任意命令。
攻击语句:
1 |
rsync -e./script.sh localhost:/tmp--server ./ |
[via@STD兄弟连]

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
