rsync的几则tips(渗透技巧)
关于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兄弟连]

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Win11 Tips Sharing: One trick to skip Microsoft account login Windows 11 is the latest operating system launched by Microsoft, with a new design style and many practical functions. However, for some users, having to log in to their Microsoft account every time they boot up the system can be a bit annoying. If you are one of them, you might as well try the following tips, which will allow you to skip logging in with a Microsoft account and enter the desktop interface directly. First, we need to create a local account in the system to log in instead of a Microsoft account. The advantage of doing this is

We often create and edit tables in excel, but as a novice who has just come into contact with the software, how to use excel to create tables is not as easy as it is for us. Below, we will conduct some drills on some steps of table creation that novices, that is, beginners, need to master. We hope it will be helpful to those in need. A sample form for beginners is shown below: Let’s see how to complete it! 1. There are two methods to create a new excel document. You can right-click the mouse on a blank location on the [Desktop] - [New] - [xls] file. You can also [Start]-[All Programs]-[Microsoft Office]-[Microsoft Excel 20**] 2. Double-click our new ex

In C language, it represents a pointer, which stores the address of other variables; & represents the address operator, which returns the memory address of a variable. Tips for using pointers include defining pointers, dereferencing pointers, and ensuring that pointers point to valid addresses; tips for using address operators & include obtaining variable addresses, and returning the address of the first element of the array when obtaining the address of an array element. A practical example demonstrating the use of pointer and address operators to reverse a string.

VSCode (Visual Studio Code) is an open source code editor developed by Microsoft. It has powerful functions and rich plug-in support, making it one of the preferred tools for developers. This article will provide an introductory guide for beginners to help them quickly master the skills of using VSCode. In this article, we will introduce how to install VSCode, basic editing operations, shortcut keys, plug-in installation, etc., and provide readers with specific code examples. 1. Install VSCode first, we need

Title: PHP Programming Tips: How to Jump to a Web Page within 3 Seconds In web development, we often encounter situations where we need to automatically jump to another page within a certain period of time. This article will introduce how to use PHP to implement programming techniques to jump to a page within 3 seconds, and provide specific code examples. First of all, the basic principle of page jump is realized through the Location field in the HTTP response header. By setting this field, the browser can automatically jump to the specified page. Below is a simple example demonstrating how to use P

Win11 tricks revealed: How to bypass Microsoft account login Recently, Microsoft launched a new operating system Windows11, which has attracted widespread attention. Compared with previous versions, Windows 11 has made many new adjustments in terms of interface design and functional improvements, but it has also caused some controversy. The most eye-catching point is that it forces users to log in to the system with a Microsoft account. For some users, they may be more accustomed to logging in with a local account and are unwilling to bind their personal information to a Microsoft account.

Forms are an integral part of writing a website or application. Laravel, as a popular PHP framework, provides rich and powerful form classes, making form processing easier and more efficient. This article will introduce some tips on using Laravel form classes to help you improve development efficiency. The following explains in detail through specific code examples. Creating a form To create a form in Laravel, you first need to write the corresponding HTML form in the view. When working with forms, you can use Laravel

Detailed explanation of the tips for using the √ symbol in the Word box. In daily work and study, we often need to use Word for document editing and typesetting. Among them, the √ symbol is a common symbol, which usually means "right". Using the √ symbol in the Word box can help us present information more clearly and improve the professionalism and beauty of the document. Next, we will introduce in detail the skills of using the √ symbol in the Word box, hoping to help everyone. 1. Insert the √ symbol In Word, there are many ways to insert the √ symbol. one
