当前位置:网站首页>Regeorg actual attack and defense
Regeorg actual attack and defense
2022-06-23 03:21:00 【Xieyongzi】
The following article comes from Jiuxianqiao No. 6 army , Author pioneer information station
This is a Jiuxianqiao unit 6 Of the 140 An article .
Total 1620 A word , Expected reading time 6 minute .
Preface
When we have passed various operations getshell After that, you want to conduct internal network horizontal penetration , But because of the goal ACL The policy settings are strict , Only HTTP The protocol and the corresponding port pass through . We cannot use port forwarding or port mapping to access other machines from the external network to the internal network . Then we think reGeorg This tool , Enter the intranet through the tool proxy , adopt HTTP Protocol forwarding request .
This tool was not created to penetrate the intranet , But some enterprise employees want to access intranet resources in the external network environment . So these security conscious kids wrote a web page that can be deployed on the border to forward traffic , So as to access an office tool on the intranet ......
You can see the ' Scabby stem ' Is said " Every office needs such tools "..
Source code analysis
So how exactly is such a powerful tool implemented ? Let's take a look at the source code :
From the entrance , It's a standard set :LOGO + argparse To support and parse parameters , The real logic starts from askGeorg Function to . This function is used to test whether the remote proxy server can access , Let's look at the details of this function :
You can see that the content is basically to judge whether it is HTTPS, Then which tool to use . use GET Method to request , If the status code is 200 And the content is the same as that in the remote server OK Of .
The content of the comparison is the sentence seen by the browser :
Python in :
php in :
Browser access :
Let's move on :
Listening to the port of the client , And set up TCP The queue limit for is 1000, This is enough for ordinary circumstances .
The next step is to create a cycle of receiving messages , And will receive the incoming session Thread and start .
session The structure of is relatively simple :
Let's look at the most important thread run The content in :
The content is not much , It is judgement. Socks4 still 5 And analyze , Then create a read / write thread and start.
Judge Socks4 still 5:
Socks Proxy requests of at least three bytes , The first byte must be 5, If it is Socks4, Then the first byte must be 4.
parseSocks5 and parseSocks4 To judge the corresponding Socks Whether the protocol resolution of is successful .
Reader:
Writer:
The read / write part is the normal operation of forwarding .
Actual combat attack and defense
Some special problems may be encountered in actual combat .
For example, accessing in the browser can lead to familiar "Georg says,'All seems fine'", It can be accessed normally . But use reGeorgSocksProxy The client will report ' Not ready , Please check url', Why is that ?
Troubleshooting requires some code debugging .
Search through printed keywords , As you can see, yes askGeorg This function returns False This causes the program to exit .
At this time, we can debug , Use Debug To follow up the code , Line by line, see what went wrong . When there is no debugging environment, you can also use the printing method to locate the problem .
Here we use the print method to locate the problem .
Let's try running the code again , See what went wrong .
You can see that the returned status code is 403, That is to say, it may be WAF Or some other security device intercepts it . We can learn from the code only when the status code is 200 It can only be used normally when , And we can use the browser to open it directly . That is to say, our problem is Python The difference between script and browser request , For example, some common request headers User-Agent 、Accept-Language etc. , We need to make up these one by one .
We need to add every request to the request header contained in the browser , So we extract this process and use it as a function .
The modified code :
setupRemoteSession Medium CONNECT:
closeRemoteSession Medium DISCONNECT:
reader Medium READ:
Writer Medium FORWORD:
After modifying the code, we actually test .
You can see that the return code has changed to 200 And printed out the familiar 'All seems fine', It indicates that it can be used normally .Happy~
summary
Master debugging / Printing and other methods are of great help to code audit and script modification . We will encounter various problems in actual combat , At this time, you need to be careful, patient and have the ability to modify the code to solve these problems . Only in this way can we make steady progress in this constantly improving attack and defense .
边栏推荐
- Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]
- 2022 opening H5 mobile page special effects
- Easysearcher cannot find the IP address of easynvr hardware. How to solve it?
- Why don't I suggest you use "! = null" to judge empty space?
- Online signature with canvas
- What is the difference between JS undefined and null
- How to generate IATA barcode in batch through TXT file
- Understand one article: build an activity analysis system
- Email authentication bypass
- "Tianzhou II" successfully docked! Three minutes to understand the shocking black technology on "Tianzhou II"! Headlines
猜你喜欢

Analysis on the development of China's satellite navigation industry chain in 2021: satellite navigation is fully integrated into production and life, and the satellite navigation industry is also boo
![Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]](/img/4b/dd272f98b89a157180bf68570d2763.jpg)
Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]
![Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]](/img/de/d73805aaf4345ca3d2a7baf85aab8d.jpg)
Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]
![Analysis on the development prospect of China's brain computer interface industry in 2021: wide application prospect, sustained and rapid growth of market scale [figure]](/img/84/192d152ceb760264b6b555b321f129.jpg)
Analysis on the development prospect of China's brain computer interface industry in 2021: wide application prospect, sustained and rapid growth of market scale [figure]

Analysis on the development of China's graphene industry chain in 2021: with the support of energy conservation and environmental protection policies, the scale of graphene industry will continue to e
![Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]](/img/28/ebfc25ec288627706e15a07e6bdb77.jpg)
Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]

Analysis on the development of duty-free industry in Hainan Province in 2021: the implementation of the new policy makes the duty-free market in Hainan more "prosperous" [figure]
![Analysis on the development status of China's watch industry in 2021: a large number of electric watches are imported [figure]](/img/ca/672bfe49c8123da8679b2abeb43a2e.jpg)
Analysis on the development status of China's watch industry in 2021: a large number of electric watches are imported [figure]

Encryption related to returnee of national market supervision public service platform
![[quick view] Analysis on the development status and future development trend of the global and Chinese diamond cultivation industry in 2021 [figure]](/img/f1/972a760459a6d599b5681aa634df09.jpg)
[quick view] Analysis on the development status and future development trend of the global and Chinese diamond cultivation industry in 2021 [figure]
随机推荐
Online signature with canvas
Copy system disk
Configuring multi cluster management using kubectl
JS judge the mobile terminal and PC terminal
Im web demo invite end hang up error avoidance
Goframe framework (RK boot): enable tls/ssl
Easygbs solution to video playback failure caused by tcp/udp configuration problems
How to configure the domain name with low code of micro build
Use ES6 new Target to simulate abstract classes
JS how to delete an item specified in an array
Mybatties plus batch warehousing
Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]
Pytest common summary
JSON. Function of the stringify() optional parameter
Establishment of JMeter distributed pressure measurement environment
How to batch generate ean14 barcode through TXT file
Blue screen and abnormal downtime DMP file and system log collection
What are the advantages of the completely free and open source flutter? How to learn about flutter?
JS event delegation (event agent)
Application of map function in JS