private void prepareDescription(AlertMessage msg) { if (msg.getConfig() != null && msg.getConfig().length > 1) { msg.setDescription(msg.getConfig()[1]); } else { msg.setDescription(chooser.getConfig().getDefaultAlertDescription()); } LOGGER.debug("Description: " + msg.getDescription().getValue()); }
/** * Reads the next bytes as a Description and writes them in the message * * @param msg * Message to write in */ private void parseDescription(AlertMessage msg) { msg.setDescription(parseByteField(AlertByteLength.DESCRIPTION_LENGTH)); LOGGER.debug("Description: " + msg.getDescription().getValue()); } }
AlertMessage alertMessage = new AlertMessage(tlsConfig); if (lm.getProtocolMessageType() == ProtocolMessageType.ALERT) { AlertMessage am = ((AlertMessage) lm); LOGGER.info(" Last protocol message: Alert ({},{}) [{},{}]", AlertLevel.getAlertLevel(am.getLevel() .getValue()), AlertDescription.getAlertDescription(am.getDescription().getValue()), am.getLevel() .getValue(), am.getDescription().getValue()); } else { LOGGER.info(" Last protocol message: {}", lm.getProtocolMessageType()); && AlertDescription.getAlertDescription(((AlertMessage) lm).getDescription().getValue()) == AlertDescription.RECORD_OVERFLOW) { LOGGER.info(" Vulnerable"); return true;
public void close() throws IOException { AlertMessage closeNotify = new AlertMessage(); closeNotify.setConfig(AlertLevel.WARNING, AlertDescription.CLOSE_NOTIFY); send(closeNotify); state.getTlsContext().getTransportHandler().closeConnection(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof AlertMessage)) { return false; } if (obj == this) { return true; } AlertMessage alert = (AlertMessage) obj; return (Objects.equals(alert.getLevel().getValue(), this.getLevel().getValue())) && (Objects.equals(alert.getDescription().getValue(), this.getDescription().getValue())); }
/** * Writes the description of the AlertMessage into the final byte[] */ private void writeDescription(AlertMessage msg) { appendByte(msg.getDescription().getValue()); LOGGER.debug("Description: " + msg.getDescription().getValue()); }
@Override protected AlertMessage parseMessageContent() { LOGGER.debug("Parsing AlertMessage"); AlertMessage msg = new AlertMessage(); parseLevel(msg); parseDescription(msg); return msg; }
/** * * @param config * @return */ @Override public List<WorkflowTrace> getPaddingOracleVectors(Config config) { List<WorkflowTrace> traceList = new LinkedList<>(); for (Record record : recordGenerator.getRecords(config.getDefaultSelectedCipherSuite(), config.getDefaultSelectedProtocolVersion())) { WorkflowTrace trace = new WorkflowConfigurationFactory(config).createWorkflowTrace( WorkflowTraceType.HANDSHAKE, RunningModeType.CLIENT); ApplicationMessage applicationMessage = new ApplicationMessage(config); AlertMessage alert = new AlertMessage(); alert.setConfig(AlertLevel.FATAL, AlertDescription.CLOSE_NOTIFY); SendAction sendAction = new SendAction(applicationMessage, alert); sendAction.setRecords(new LinkedList<AbstractRecord>()); sendAction.getRecords().add(record); sendAction.getRecords().add(new Record(config)); trace.addTlsAction(sendAction); trace.addTlsAction(new GenericReceiveAction()); traceList.add(trace); } return traceList; } }
private boolean receivedFatalAlert(List<ProtocolMessage> messages) { for (ProtocolMessage message : messages) { if (message instanceof AlertMessage) { AlertMessage alert = (AlertMessage) message; if (alert.getLevel().getValue() == AlertLevel.FATAL.getValue()) { return true; } } } return false; }
@Override public void adjustTLSContext(AlertMessage message) { if (tlsContext.getTalkingConnectionEndType() == tlsContext.getChooser().getMyConnectionPeer() && AlertLevel.FATAL.getValue() == message.getLevel().getValue()) { LOGGER.debug("Setting received Fatal Alert in Context"); tlsContext.setReceivedFatalAlert(true); } } }