Yes, it's fine and the basis for interleaved storage. Each buffer is just a section of memory that other commands can point to. You don't even need to bind it to GL_ELEMENT_ARRAY_BUFFER while setting the data.
You will have to ensure the data doesn't overlap:
GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
//allocate the buffer, passing in null just allocates
glBufferData(GL_ARRAY_BUFFER, vertexSize+indexSize*sizeof(int), 0, GL_STATIC_DRAW);
// Buffer the Index Data at the start of the buffer
glBufferSubData(GL_ARRAY_BUFFER, 0, indexSize*sizeof(int), indexData);
// Buffer the Vertex Data right after that
glBufferSubData(GL_ARRAY_BUFFER, indexSize*sizeof(int), vertexSize, vertexData);
you'll need to offset the glVertexAttribPointer pointer parameter to signal where it starts.
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
glVertexAttribPointer(0, 3, GL_FLOAT, false, sizeof(vertex), (void*)(indexSize*sizeof(int)));
glVertexAttribPointer(1, 3, GL_FLOAT, false, sizeof(vertex), (void*)(indexSize*sizeof(int) + 3*sizeof(float)));
//...
and when drawing you need to pass in the proper offset for drawing (0 if you put it first otherwise the offset you specified in the corresponding glBufferSubData call)
glDrawElements(GL_TRIANGLES, indexSize, GL_UNSIGNED_INT, 0);